Consulting

Results 1 to 7 of 7

Thread: Solved: Insert Image from Userform Commandbutton.

  1. #1

    Solved: Insert Image from Userform Commandbutton.

    In my userform, I have an image on my commandbutton. When the user clicks the commandbutton I want that image to be inserted into the worksheet. I want to create this as part of an Addin. Is this possible to do if the user does not have the image source file on their computer?

    Here is the code I have so far (which does not work):

    Private Sub cmdInsert_Click()
    Range("D1").Value = cmdInsert.Picture
    End Sub

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Store the image in the workbook that the form lives in and copy it from there.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Quote Originally Posted by xld
    Store the image in the workbook that the form lives in and copy it from there.
    How do I reference an object in the Addin workbook? I tried this and I could only access the open workbook objects (not the addin).

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Shouldn't be a problem

    [vba]

    ThisWorkbook.Worksheets("images").Shapes("myPic").Copy
    ActiveWorkbook.Worksheets("Sheet1").Paste
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Shouldn't be a problem

    [vba]

    ThisWorkbook.Worksheets("images").Shapes("myPic").Copy
    ActiveWorkbook.Worksheets("Sheet1").Paste
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    Thanks xld,
    This just opened up a lot of doors for me!
    Gabe

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    That's great. A simple answer that creates possibilities, sharing at its best, what more could we ask for
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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