nst1107
11-22-2008, 12:21 AM
I have an image (Image1) on a form. On Image1_DoubleClick, I have the user select a file to upload to the image control. The problem is I don't know how to then set the selected file as the picture for the image. Here's what I have:
Private Sub Image1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim pic As Object
ChDrive (ThisWorkbook.Path)
ChDir (ThisWorkbook.Path)
r = Application.GetOpenFilename("Picture Files (*.bmp; *.cur; *.gif; *.ico;_
*.jpg; *.wmf),*.bmp; *.cur; *.gif; *.ico; *.jpg; *.wmf", , "Load Image")
If r = False Then Exit Sub
'Image1.Picture = r
'set pic = createobject("Excel.
End Sub
Setting the Picture property of Image1 to the selected filename (r) didn't work because r is a string. Setting pic = CreateObject(...) didn't work, because I barely know how to use that function. Just remember seeing it somewhere in this forum.... Any suggestions?
Private Sub Image1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim pic As Object
ChDrive (ThisWorkbook.Path)
ChDir (ThisWorkbook.Path)
r = Application.GetOpenFilename("Picture Files (*.bmp; *.cur; *.gif; *.ico;_
*.jpg; *.wmf),*.bmp; *.cur; *.gif; *.ico; *.jpg; *.wmf", , "Load Image")
If r = False Then Exit Sub
'Image1.Picture = r
'set pic = createobject("Excel.
End Sub
Setting the Picture property of Image1 to the selected filename (r) didn't work because r is a string. Setting pic = CreateObject(...) didn't work, because I barely know how to use that function. Just remember seeing it somewhere in this forum.... Any suggestions?