+ Reply to Thread
Results 1 to 4 of 4

Insert Picture from a Folder to Excel if it meets specific content

  1. #1
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    378

    Insert Picture from a Folder to Excel if it meets specific content

    Hello,

    I'm trying to explain as clear as possible here. I got a VBA code to insert an image file from a specific folder to my excel workbook. However, this code requires the image file name has to be as an item number.

    For example, if I want to pull an image of an item called "17001", I have to enter "17001" from excel and use VBA to pull that image from the folder. The name of the file needs to be "17001.jpg" to be able to pull the image.

    It is very simple until recently when I received an image database from the coworker and he names the images with item number and item description. Now the name of the file contains something like "17001_Rubber_Ball_Large_Size.jpg". I could not pull the image from the folder anymore since the file name has different description from the cell value. I just want to use the Item number to search for the image.

    Could you please help me modify the vba code below so that it can look up the item number 17001 from the cell value and automatically retrieve the file name which contain the item number and its description ?


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Insert Picture from a Folder to Excel if it meets specific content

    Assuming the format remains the same, for example starting with 17001, and only 1 file name starts with '17001', then

    Please Login or Register  to view this content.
    should do it...

    I'd be careful with this line
    Please Login or Register  to view this content.
    FileName will only contain the file name ("17001_Rubber_Ball_Large_Size.jpg") - you will probably have to add the full path same as you did for the DIR...
    Last edited by cytop; 06-22-2017 at 04:48 PM.

  3. #3
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Insert Picture from a Folder to Excel if it meets specific content

    You are right. The specific file did not find as it need the full path for the Set Pic. How can we address this problem?

  4. #4
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Insert Picture from a Folder to Excel if it meets specific content

    Quote Originally Posted by cytop View Post
    Assuming the format remains the same, for example starting with 17001, and only 1 file name starts with '17001', then

    Please Login or Register  to view this content.
    should do it...

    I'd be careful with this line
    Please Login or Register  to view this content.
    FileName will only contain the file name ("17001_Rubber_Ball_Large_Size.jpg") - you will probably have to add the full path same as you did for the DIR...
    Could you help address this issue?

+ 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. Insert picture from folder in excel cell
    By ArH in forum Excel General
    Replies: 8
    Last Post: 02-17-2020, 07:56 AM
  2. Loop to insert picture corresponding to content of a cell
    By kisnah in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-27-2015, 10:22 PM
  3. [SOLVED] Insert Picture to excel from subfolders and save as folder name
    By gincemathew in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-14-2013, 10:01 AM
  4. Creating macro to insert a picture by including specific picture name & path
    By NissaFrenchRamsteyn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2012, 05:40 AM
  5. Insert newest Picture in folder into Spreadsheet
    By 123rich456 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-18-2012, 02:39 PM
  6. Insert/format Picture From Folder
    By Vlad999 in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 01-18-2007, 10:23 PM
  7. insert picture from file based on cel value/content
    By Jamaican Teacher in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-08-2006, 01:30 PM

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