+ Reply to Thread
Results 1 to 32 of 32

show jpeg picture inside a userform image control box

  1. #1
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    show jpeg picture inside a userform image control box

    hi
    I have a jpeg image that the path is saved to a cell, i hyperlink to userform but cannot get it to resize and show in userform image control box,just ap
    pears on screen
    any ideas please
    cheers colin
    Last edited by cfinch100; 07-28-2013 at 01:37 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: show jpeg picture inside a userform image control box

    Colin

    What do you mean you 'hyperlink' to the userform?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi
    on sheet in a cell, I open hyper link and load picture wanted ,I put cmdbutton on form and add
    Please Login or Register  to view this content.
    where tb15 is the name of the picture saved ,when commandbutton is clicked it loads picture to full screen,where I can print this is .pdf,i converted this picture to jpeg and did same again but this loads to half screen and not in image box,its there fairly instantly ,added
    Please Login or Register  to view this content.
    to private sub listbox,works well,in unit type 100,in list box click on any of top 2 entries ,path comes up in tb15 and picture loads but not in box and too big
    hope this helps
    cheers colin
    Attached Files Attached Files

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: show jpeg picture inside a userform image control box

    Colin

    Why are you hyperlinking?

    If you want to load an image in an image control use LoadPicture.

    Hyperlinking is just going to open it in a browser window.s

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: show jpeg picture inside a userform image control box

    Accidental duplicate.

  6. #6
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi
    having problems with using load picture,have tried a few different ones and cannot get it right,can enter picture in properties ,it loads but not resize to fit and this only lets me load one picture
    cheers colin

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: show jpeg picture inside a userform image control box

    Colin

    What problems are you having?

    Wrong picture? Wrong size? Exploding monitor?

  8. #8
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi norie
    will not load picture all
    cheers colin

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: show jpeg picture inside a userform image control box

    Colin

    Can you post the code you are using to try and load the picture?

    Also, are you sure that code is actually executing?

  10. #10
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    Please Login or Register  to view this content.
    hi norie
    this is the code in listbox
    cheers colin

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: show jpeg picture inside a userform image control box

    Sorry, the code is where?

  12. #12
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    in the private sublistbox click
    cheers colin

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: show jpeg picture inside a userform image control box

    Works fine for me, have you checked the path and filename are valid?

  14. #14
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi
    yes now keeps saying path not found,will keep trying
    cheers colin

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: show jpeg picture inside a userform image control box

    At least something's happening now.

    PS Why not set up a dummy form with an image control in a blank workbook and test things there?

  16. #16
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi norie
    will do thanks
    cheers colin

  17. #17
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi norie
    have done that if I put .jpeg it says path can not be found if I put .jpeg.jpg says object not found,even moved file to c:\5t.jpeg
    ,cheers colin

  18. #18
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi
    I have found code on a forum but when I run says it can not find file ,but its there any ideas please,had it display one jpeg pic when adjusted code in private sub listbox ,but no other, please help required
    cheers colin
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    03-14-2012
    Location
    location
    MS-Off Ver
    Excel 2007
    Posts
    170

    Re: show jpeg picture inside a userform image control box

    for the first step you can try to add it on your userform...then you'll see how to control it
    Please Login or Register  to view this content.
    blue

  20. #20
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: show jpeg picture inside a userform image control box

    Colin

    Your code doesn't check for the existence of a file.

    If you want to do that use Dir.

    Where is the actual path anyway, you only seem to have a filename, and that doesn't look right - for one thing files don't normally have 2 file extensions.

    What is the actual path to the image(s)?

    If you aren't sure of that open Windows Explorer, navigate to the folder then either copy the path from the address bar or right click and select Copy Address as text.

    Then you can paste it somewhere.

    What are there file names?

    If you want to find out the filenames you could run this in an empty workbook.
    Please Login or Register  to view this content.

  21. #21
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi blue.chio
    have done that and brings first one up no problem , run time error 53 occurs when I change the number eg 1t.jpeg to 5t.jpeg although the path is the same up to that double click on the file on sheet1 opens it up though
    cheers colin

  22. #22
    Forum Contributor
    Join Date
    03-14-2012
    Location
    location
    MS-Off Ver
    Excel 2007
    Posts
    170

    Re: show jpeg picture inside a userform image control box

    try to add a listbox, let' s say listbox2 and just try to see if the images are changing...

    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.

  23. #23
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: show jpeg picture inside a userform image control box

    Have a look at the attached.

    It's a bit rough but perhaps it'll help.
    Attached Files Attached Files

  24. #24
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi
    run time 424 with blue chio answer and my path is
    Please Login or Register  to view this content.
    which seems to be right ,loads one pic but no others
    cheers colin
    Last edited by cfinch100; 07-28-2013 at 11:05 AM.

  25. #25
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi norie
    have tried that and all files are there and same as on sheet have tested from sheet they all ok,just goes amiss when try to put on userform ,more than one picture anyhow
    cheers colin

  26. #26
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Are you sure you are getting the correct path and filename from the sheet every time?

    How are you actually getting them?

  27. #27
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi norie
    ive gone to sheet ive hyperlinked the path and tried the link ,then typed in the path as well and when run program it did not recognise it,once it said unknown file flashed up picture then said unknown file again
    cheers colin

  28. #28
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi
    ive just looked at this version and whatever you pick says does not exist
    cheers colin
    Attached Files Attached Files

  29. #29
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: show jpeg picture inside a userform image control box

    Why have you hyperlinked?

    Just put the full path and filename in the cell, not just the filename.

    Without the path VBA will look for the image file in the current directory, whatever that is.

    Also, if the files are on a network drive you might want to look at using the UNC address.

  30. #30
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi
    all works after all that it was the path as you had said earlier,not entered properly by me
    many thabks to you for sticking with it
    thankyou colin

  31. #31
    Forum Contributor
    Join Date
    03-14-2012
    Location
    location
    MS-Off Ver
    Excel 2007
    Posts
    170

    Re: show jpeg picture inside a userform image control box

    Hi Colin
    Thank you for the feedback! And for the rep also, the credits have to go to Norie! He/She offered a very nice example and it works excellent.

    Cheers!

  32. #32
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: show jpeg picture inside a userform image control box

    hi
    gave rep to both of you for last 2 threads
    cheers colin

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to access bitmap picture stored as property of image control on userform
    By Spere in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-17-2013, 05:41 PM
  2. Remove picture from Image Control?
    By Jon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-09-2006, 09:45 PM
  3. [SOLVED] Programatically control picture property of Image control
    By Brassman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2005, 05:06 PM
  4. Programatically control picture property of Image control
    By Brassman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-24-2005, 10:11 AM
  5. Copy picture from image control
    By Ian in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-08-2005, 11:06 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1