+ Reply to Thread
Results 1 to 31 of 31

Get picture from folder that contains what is in the corelating cell

  1. #1
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Get picture from folder that contains what is in the corelating cell

    Hello All,

    The code that I have been using for production reports takes the entire name of a part and pulls the picture based on the entire name. The issue with this is that some pictures are named inconsistently.

    I was hoping for a macro that can pull a .jpg file that contains a piece of the number before the right-most dash.

    ISSUE - There is multiple files that contain the number before the right-most dash.

    Example:

    I want to pull a picture that contains A1234 in it...

    there are pictures in the folder labeled A1234-01 , A1234-02 , A1234-01_A etc.

    It really doesn't matter which one it picks out of that group.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    You could try this

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Unhappy Re: Get picture from folder that contains what is in the corelating cell

    The input box is an interesting idea, but I was hoping for something alittle more automated as the production report has about 300 parts in it.

    Attached is an example of what it may look like. The "Reduced TO" column is what I want it to pull from. The code I have been messing with sends me errors because of what I believe to be is too many options to pick from. (eg. A1000 could be picked as A1000-01,A1000-02 etc.) I am not sure how to pull a generalized file from a folder and have been lurking the internet for answers lmao.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    Re: "but I was hoping for something a little more automated"
    No problem but without pertinent info very difficult.
    I tried it with some pictures and it worked flawlessly.
    You could let us know in which Column these abbreviated names are, Column B like your attachment?, do you want to select a cell with the abbreviated name and bring up the picture?
    Are the file extensions indeed jpg or could they be jpeg?
    Are you sure there are no spaces, a very common problem, in either the file name or in the name in Column B?
    Last edited by jolivanes; 01-07-2021 at 12:58 PM.

  5. #5
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    Thanks for the reply Jolivanes. Yes column B is where the abbreviated version is created from column A. I do also want to select column B's abbreviated name and bring up the picture in column C. All files are .jpg. Im fairly sure that spacing is not the issue.

    What I am wondering is if the issue is that my picture folder has multiple options for the abbreviated name. Could you run a trial with that possibility also?

    Example:

    Abbreviated is A1000
    Pictures in folder: A1000-01 , A1000-02 , A1000-02_A

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    Re: "What I am wondering is if the issue is that my picture folder has multiple options for the abbreviated name". What does this mean?
    And yes, I ran it with three same names except the last digit. Picked the first one in the folder.

  7. #7
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    So I am not getting an error but no pictures are populating.

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    Try this attachment.
    BTW, you did not have a backslash after "epicore" in your code in the attachment.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    Awesome jolivanes,

    These userforms are super cool. Is there a way to make it do multiple at once instead of individually?

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    Like I asked before, explain properly.
    "multiple at once" means what? Multiple different selections in Column B or multiple selections in the UserForm ListBox?

  11. #11
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    Sorry, I mean multiple values in column B. B2 is A1000 B3 is 600-000 etc.

  12. #12
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    What is meant to be the end result?
    Do you want to go through the column and place pictures from each selection somewhere?

  13. #13
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    End goal is that the macro runs and takes the abbreviated version from column B and places a picture into Column C in the same row beside it.

  14. #14
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    No manipulation of the picture required once when placed in the cell beside the name?
    Mock up a representative attachment with not just 3 cells.
    It should show the sheet before the macro is run and after the macro is finished.

  15. #15
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    Okay, This is what I got. Sheet 1 is before and sheet 2 is after. Note picture 3 is shown twice because they have the same abbreviation.
    Attached Files Attached Files

  16. #16
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    Is the attachment a true copy of your original as asked for?

  17. #17
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    If your attachment is a true copy, with the filenames in Column A of Sheet2, this should do it.
    Please Login or Register  to view this content.

  18. #18
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    You have this on Sheet1, the "before" sheet.
    A9018-2123-98
    G05354549-101

    And you have this in Sheet2, the "after" sheet.
    A9018-2123
    G05354549-101
    A1000-01
    A1000-02

    So how do you end up with the 2 x A1000 figures?

    And why is A2 in Sheet2 different from A3 in Sheet1?
    Last edited by jolivanes; 01-08-2021 at 10:22 PM.

  19. #19
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    The attached has 2 possibilities for you to play with.
    One with the abbreviations in a separate sheet and one with the abbreviations in the "Master" sheet. (= Sheet2 in the attachment)
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    Wow I am blown away. This is amazing!!

    The maybe so macro doesn't really apply to my application but the sheet 2 one nails it!!!

    The only is I am having as you can see attached is it duplicates it below. I only filled out from A3 to B6 btw.
    Attached Images Attached Images

  21. #21
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    Did you clear the sheet before you ran it a 2nd time?

  22. #22
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    Yes, it is clearing the abbreviations column which is fine but it then copies those four values and brings the part number and pictures also.

  23. #23
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    Do I read you right.
    It does not clear everything just entered, Column A, B and Pictures in Column C?
    I put the "Undo Maybe So Result" button in for myself to test. But if you want it, I'll have to change the code behind it.

  24. #24
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    I am only using the Sheet 2 button. I have attached two images, the first being before I click and the second being after clicked. I am not sure why it is duplicating as shown.
    Attached Images Attached Images

  25. #25
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    Don't enter any info in Column A and try again.


    You can change the code for clearing the sheet to this if you want.
    Please Login or Register  to view this content.
    Last edited by jolivanes; 01-11-2021 at 01:45 PM. Reason: extra info

  26. #26
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    If this still stands (from Post #1)
    "It really doesn't matter which one it picks out of that group."
    Then change this
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.
    or just add "Do" and a space in front of "While", add "Exit Do" as a line before the "End If" statement and change "Wend" to "Loop"

  27. #27
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    That unfortunately did not resolve the issue. Also the "doesn't matter which one out of abbreviated group" does still apply yes.

  28. #28
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    I can't replicate your problem.
    With the changes from Post #26, in the Workbook here, your attachment from Post #15, it only shows a picture for each entry in the Abbreviations column.
    Do you start out with an empty workbook and only put the abbreviations in?

  29. #29
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    No I put in the Part number and the Abbreviations before running the code, should I not?

  30. #30
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Get picture from folder that contains what is in the corelating cell

    Does that not defeat the purpose?
    Only put in the abbreviated file name and see what happens.
    As I understand your Post #1, you have part of a file name and want to find a file with it's name starting with that part of the file name.
    If you're going to use the whole file name, no need to worry about finding that name through a part of it.

  31. #31
    Registered User
    Join Date
    12-17-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    26

    Re: Get picture from folder that contains what is in the corelating cell

    right, so the purpose of this list is to have the part numbers that we are currently working on in this list with the full name (ex.1234-01). I also have a picture beside it so it is easily recognizable. The difference between 1234-01 and 1234-02 is very little and is barley noticeable in a picture. This is where the abbreviations come in.

    In sort, Final product i will be hiding the abbreviated column at the end. I use a seperate macro to fill Column A with the full part name of the parts we are working on. If in this macro it could pull the abbreviated version into Column B based on Column A then pull the picture based on Column B that is end goal.

+ 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. [SOLVED] Show Picture From Picture Sheet Instead of External Folder Codes
    By ynab in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-29-2020, 09:08 AM
  2. Insert picture from folder in excel cell
    By ArH in forum Excel General
    Replies: 8
    Last Post: 02-17-2020, 07:56 AM
  3. How to import picture file from folder using cell value?
    By sukeshparikh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-24-2013, 09:01 AM
  4. How to import picture file from folder using cell value?
    By kaypat in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-30-2013, 05:39 PM
  5. When i Copy Folder to new destination i lose customised folder icon/picture
    By sternboy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-29-2012, 09:30 PM
  6. Excel 2007 : Corelating line and column in 2 axis graph
    By navdeepsj in forum Excel General
    Replies: 1
    Last Post: 09-03-2010, 07:50 AM
  7. Use VBA to crop a picture and save the picture in a folder
    By Cookstein2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2009, 12:01 PM

Tags for this Thread

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