Hi all,
I am new to VBA and would appreciate step by step help.
I have a userform with an image on it. What I would like is to change the pic
ture during run time. I achieved that but each time when I unload the form the old picture is back..so how can I store the new one ? And here is my code
Private Sub Label7_Click()
Dim strFileName As String
strFileName = Application.GetOpenFilename(FileFilter:="Tiff Files(*.tif;*.tiff),*.tif;*.tiff,JPEG Files (*.jpg;*.jpeg;*.jfif;*.jpe),*.jpg;*.jpeg;*.jfif;*.jpe,Bitmap Files(*.bmp),*.bmp", FilterIndex:=2, Title:="Select a File", MultiSelect:=False)
If strFileName = "False" Then
MsgBox "No File Selected!"
Else
Me.Image8.Picture = LoadPicture(strFileName)
Image8.Height = 96
Image8.Top = 174
Image8.Width = 204
'MsgBox strFileName
'SavePicture Image, "test.bmp" ' does not work error message ????
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Me.Repaint
End If
End Sub
Thx in advance....
I am new to VBA and would appreciate step by step help.
I have a userform with an image on it. What I would like is to change the pic
ture during run time. I achieved that but each time when I unload the form the old picture is back..so how can I store the new one ? And here is my code
Private Sub Label7_Click()
Dim strFileName As String
strFileName = Application.GetOpenFilename(FileFilter:="Tiff Files(*.tif;*.tiff),*.tif;*.tiff,JPEG Files (*.jpg;*.jpeg;*.jfif;*.jpe),*.jpg;*.jpeg;*.jfif;*.jpe,Bitmap Files(*.bmp),*.bmp", FilterIndex:=2, Title:="Select a File", MultiSelect:=False)
If strFileName = "False" Then
MsgBox "No File Selected!"
Else
Me.Image8.Picture = LoadPicture(strFileName)
Image8.Height = 96
Image8.Top = 174
Image8.Width = 204
'MsgBox strFileName
'SavePicture Image, "test.bmp" ' does not work error message ????
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Me.Repaint
End If
End Sub
Thx in advance....