Consulting

Results 1 to 4 of 4

Thread: getting image from userform image control

  1. #1

    getting image from userform image control

    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.

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,064
    Location
    What have you got so far?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    Here is the code to get the picture loaded to the userform

    [VBA]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[/VBA]

    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.

  4. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    [VBA]Sheet1.Image1.Picture = LoadPicture(PictFileName)[/VBA]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •