View Full Version : getting image from userform image control
ccollins48
11-16-2008, 07:27 AM
I need VBA Code to get an image in a image control on a userform to an image control on an excel worksheet when I click the submit button control.
Aussiebear
11-16-2008, 11:26 AM
What have you got so far?
ccollins48
11-16-2008, 04:57 PM
Here is the code to get the picture loaded to the userform
Private Sub Image1_Click()
Dim PictFileName As String
PictFileName = Application.GetOpenFilename
PicPath = PictFileName
If Len(Dir(PicPath)) = 0 Then
MsgBox PicPath & " does not exist."
Else
Me.Image1.Picture = LoadPicture(PicPath)
Me.Repaint
'ActiveWorkbook.Sheets("SO916").
ImgWorkSheet = LoadPicture(PicPath)
End If
End Sub
I also inserted this code on the worksheet itself, changing the name of the image control, and got the same ability to insert a picture on the worksheet.
My goal is I fill out the userform and insert the picture, then I click the submit button, all the information from the form is transferred to the worksheet.
I have all the text to transfer OK, I'm just having problems with the picture.
Kenneth Hobs
11-16-2008, 08:14 PM
Sheet1.Image1.Picture = LoadPicture(PictFileName)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.