+ 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,242

    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,242

    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

X vBulletin 4.1.8 Debug Information

  • Page Generation 0.06467 seconds
  • Memory Usage 9,002KB
  • Queries Executed 14 (?)
More Information
Template Usage (32):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (5)bbcode_code
  • (1)footer
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (7)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (4)navbar_noticebit
  • (6)option
  • (7)postbit_legacy
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (4)showthread_bookmarksite
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper
  • (1)vbseo_linkbackmenu_entry 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (39):
  • ./vbseo.php
  • ./env.php
  • ./vbseo/includes/functions_vbseo.php
  • ./vbseo/includes/functions_vbseo_pre.php
  • ./vbseo/includes/functions_vbseo_url.php
  • ./vbseo/includes/functions_vbseo_createurl.php
  • ./vbseo/includes/functions_vbseo_db.php
  • ./vbseo/includes/functions_vbseo_vb.php
  • ./vbseo/includes/functions_vbseo_seo.php
  • ./vbseo/includes/functions_vbseo_misc.php
  • ./vbseo/includes/functions_vbseo_crr.php
  • ./vbseo/includes/functions_vbseo_cache.php
  • ./vbseo/includes/functions_vbseo_hook.php
  • ./vbseo/includes/functions_vbseo_startup.php
  • ./includes/config.php
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/functions.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/functions_cforum.php
  • ./includes/functions_facebook.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (46):
  • init_startup
  • friendlyurl_resolve_class
  • database_pre_fetch_array
  • database_post_fetch_array
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • fetch_musername
  • cache_templates
  • template_register_var
  • parse_templates
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • reputation_image
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • showthread_bookmarkbit
  • navbits
  • navbits_complete
  • showthread_complete


Search Engine Friendly URLs by vBSEO 3.6.0 RC 1