Results 1 to 9 of 9

Thread: RESOLVED[Insert a Picture in a UserForm from a Worsheet]

  1. #1

    Thread Starter
    Addicted Member Fonty's Avatar
    Join Date
    May 2006
    Location
    New York
    Posts
    173

    Resolved RESOLVED[Insert a Picture in a UserForm from a Worsheet]

    I want to insert a picture in a UserForm. However this picte is already located in a worksheet of the workbook. How can I do this?
    Last edited by Fonty; May 18th, 2006 at 12:41 PM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Insert a Picture in a UserForm from a Worsheet

    Welcome to the Forums.

    Is your picture an Inlineshape or an OLEObject?

    You would reference which ever it is and add a Image control to your userform and set the Picture property to the referenced image.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Addicted Member Fonty's Avatar
    Join Date
    May 2006
    Location
    New York
    Posts
    173

    Re: Insert a Picture in a UserForm from a Worsheet

    What is the difference between an Inlineshape or an OLEObject?
    I have two differente pictures I would like to insert. One is a jpg picture that is in the worksheet and the other one is a drawring I made with the drawing tools in Excel.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Insert a Picture in a UserForm from a Worsheet

    Did you do an Insert Image from the Insert menu or created the image/shape from the drawing oolbar? Te only difference is how we will access and reference the image.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Addicted Member Fonty's Avatar
    Join Date
    May 2006
    Location
    New York
    Posts
    173

    Re: Insert a Picture in a UserForm from a Worsheet

    I have both. One inserted in the worksheet using the Insert Image and one created with the drawing toolbar. And I'd like to use both images.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Insert a Picture in a UserForm from a Worsheet

    The one that is from the insert image is a Shape or OLEObject.

    You can reference it but not the image or picture property.


    VB Code:
    1. ThisWorkbook.Sheets("Sheet1").Shapes(1)
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Addicted Member Fonty's Avatar
    Join Date
    May 2006
    Location
    New York
    Posts
    173

    Re: Insert a Picture in a UserForm from a Worsheet

    Yes. In fact I'm able to manipulate them on the sheet. I have for example:

    VB Code:
    1. ActiveSheet.Shapes(tipogas).Visible = True

    Where tipogas was a String I defined. However my issue is to be able to see an Image displayed in the UserForm. I want to put 5 different option buttons and the picture to which each option is reffered to upon the button.

  8. #8
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Insert a Picture in a UserForm from a Worsheet

    Hi Fonty

    i remember reading a same problem earlier so i just searched the web and finally found it

    Click the link below and read the solution given by Stephen Bullen.

    http://groups.google.co.in/group/mic...305eb70bd975c7

    Hope this helps...

  9. #9
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Insert a Picture in a UserForm from a Worsheet

    Have a look at my code in the following thread for the PastePicture function. In this case it is used to copy a Chart picture to a UserFrom, but could also be used to copy any picture.
    http://www.vbforums.com/showthread.php?t=402588
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

Posting Permissions

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



Click Here to Expand Forum to Full Width