+ Reply to Thread
Results 1 to 7 of 7

Insert jpg image from file path to image frame

  1. #1
    Forum Contributor
    Join Date
    08-17-2009
    Location
    West Midlands
    MS-Off Ver
    Excel 2016
    Posts
    213

    Insert jpg image from file path to image frame

    Morning all,

    I am tearing my hair out with this one.

    I have a list of images saved on a server named 0001.jpg, 0002.jpg, 0003.jpg etc... etc...
    The file path for these images is P:\Sales\Images\Nov 12

    I have created a spreadsheet with a combo box (Sheet 1) that lists the image numbers and these are linked to cell A6. I have created a CONCATENATE formula in cell A7 so that it reads 0001.jpg etc...

    I have also added an ActiveX Image control (Image 1) to the spreadsheet.

    What I would like is for the user to select the image name from the combo box and for the image to be displayed in the Image control.

    There must be a fairly easy way of doing this - but it's driving me crazy. Any help would be greatly appreciated.

    Apologies, I can't upload a sample document as my company's firewall seems to be blocking it.

    Thanks

    Steve
    Last edited by SAsplin; 11-27-2012 at 10:32 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Insert jpg image from file path to image frame

    Not the full solution, but at its simplest see if you can adapt the following line:
    Please Login or Register  to view this content.
    Post responsibly. Search for excelforum.com

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Insert jpg image from file path to image frame

    Try this, it should load the picture, when you make a selection from the combobox.
    Please Login or Register  to view this content.
    Edit folder location.

  4. #4
    Forum Contributor
    Join Date
    08-17-2009
    Location
    West Midlands
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Insert jpg image from file path to image frame

    Thanks for the reply guys. It works, but...

    Not all of the numbers has images - I've had to add error handling to stop it debugging when it can't find an image.

    What can I add to the code to make it display "No Image Available" if there is no corresponding image?

    Many thanks.

  5. #5
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Insert jpg image from file path to image frame

    How are you populating the combo box? It doesn't make sense from a user POV to populate the combo box with image numbers which don't exist. Use a Dir function loop to populate the combo box with .jpg's which exist in the folder. Otherwise don't use error handling if it can't find an image, instead try:
    Please Login or Register  to view this content.
    where imageFolder is a string containing the folder path.

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Insert jpg image from file path to image frame

    You can add a comand button to the sheet and use this code to populate the combobox with just .jpg files in the folder.
    Please Login or Register  to view this content.
    Then in the combobox xhange use this code
    Please Login or Register  to view this content.
    If you have revised the properties of the combobox1, it may be best just to delete the combobox and draw another. Then change the code to whatever combobox number it is.

  7. #7
    Forum Contributor
    Join Date
    08-17-2009
    Location
    West Midlands
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Insert jpg image from file path to image frame

    Thanks again for the replies. The combo box is a list of parts (not all of which has a photo). However, the spreadsheet provides other information on ALL parts. This is why I need all parts on the combo list and where there isn't a photo to return 'NO IMAGE AVAILABLE' in the image frame.

    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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