+ Reply to Thread
Results 1 to 24 of 24

Image Lookup from Folder

  1. #1
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Image Lookup from Folder

    Hi All,

    i'm struggling on this lookup,

    Lookup based on Empl ID images are in folder.
    gave a folder path : C:\Users\raja\Pictures\Empl Photos
    Photo name Must in Empl ID format: (e.g) 10001

    If it's possible.... Please help
    Attached Files Attached Files

  2. #2
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Image Lookup from Folder

    HTML Code: 
    Refer link will help you.


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Image Lookup from Folder

    The link above from @avk inserts images in a cell without VBA and looks up images already embedded in the workbook
    This method inserts images using VBA and looks up those images in a folder dynamically
    Both methods work well

    1. Add an extra image in your folder with name DefaultImage.jpg
    - this is the image used if filename in cell C4 does not exist
    - prevents the code failing

    2. Insert the code below in the sheet's module
    - right-click on sheet tab
    - select View Code
    - paste code below into code window
    - {Alt}{F11} to return to Excel

    3. Save as macro enabled workbook

    4. Test
    - amend the value in B4 (which drives formula in C4)
    - the image in cell E2 changes whenever value in C4 changes

    5. 10002 in cell B4 creates this path : C:\Users\raja\Pictures\Empl Photos\Raj -10002.jpg


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kev_; 02-16-2019 at 04:09 AM. Reason: Code apended to delete previous photo
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Re: Image Lookup from Folder

    thank for reply

    This code copy & paste to my Main work Book that's not working... pls Check this

    pasted as per you said

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Image Lookup from Folder

    How can anyone check anything when all you tell them is "that's not working"?

    More detailed information, please.

    • Does the code run?
    • Does it run but do nothing?
    • Does it produce error messages? If so, what do the messages say?
    • Does it produce unexpected/wrong results? If so, how do the results differ from what you expect?
    • Does it hang?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Re: Image Lookup from Folder

    i paste on my main workbook and run the macro nothing is happen. my old macro running partially.

    if you see my attachment understand my points

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Image Lookup from Folder

    You have not posted the workbook with the code pasted from post #3. You will need to do so if you want help troubleshooting this.

  8. #8
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Image Lookup from Folder

    @ Raj.xls
    - I attached a workbook which contain the code
    Have you opened the workbook and tested it?

  9. #9
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Re: Image Lookup from Folder

    Sorry forgot to attach
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Re: Image Lookup from Folder

    Hi Kev,

    i tested it's showing debug in this line

    Set Pic = ActiveSheet.Pictures.Insert(FullPath)

  11. #11
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Re: Image Lookup from Folder

    I explain clearly, 1st kev create a code and attach i tried its showing debug in this line Set Pic = ActiveSheet.Pictures.Insert(FullPath).
    And i copied that and paste in my main workbook and run the macro previous macro not run (C3. clear-content ) this line . That's why i attached My Main Workbook.


    Attachment #9
    Last edited by Raj.xls; 02-16-2019 at 06:57 AM.

  12. #12
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Image Lookup from Folder

    I think I made a small mistake

    Please Login or Register  to view this content.
    should be
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Re: Image Lookup from Folder

    Hi Kev,

    Thanks for Reply. That's working really you are great.

    One small request,
    My actual purpose this workbook is empl login entry, already i have one macro in same sheet for capture (id, name & Login time)
    And added your macro & run its showing a popup (ambiguous name detected: worksheet change)

    attached Main workbook

    how i can run both the macros in same worksheet.. please guide me.
    Attached Files Attached Files
    Last edited by Raj.xls; 02-17-2019 at 03:17 AM.

  14. #14
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Image Lookup from Folder

    Try combining the 2 macros like this
    Please Login or Register  to view this content.

    You do not need to do this but (to be consistent) consider..
    EITHER amending
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    OR amending
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Re: Image Lookup from Folder

    Hi Kev

    i tried, its showing a popup like this (sub or function Not defined)

    Please fix

  16. #16
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Image Lookup from Folder

    Is procedure InsertPic still in your code? (looks like VBA cannot find it)

    If you cannot fix it then post your code for me to check
    Use code tags - click on # icon (above post window) and paste code between the tags
    [ CODE] paste code here [/CODE]
    Last edited by kev_; 02-18-2019 at 06:43 AM.

  17. #17
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Re: Image Lookup from Folder

    please attach the file with code

  18. #18
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Re: Image Lookup from Folder

    Anyone help for This

    Actual purpose is if enter Empl ID, Date, Login time Etc. information i'll update in next sheet at the same time image display on sheet from folder. i have code BUT

    i don't know what is wrong in CODE

    Please correct where its wrong

    Please Login or Register  to view this content.
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    10-13-2015
    Location
    Culloden, West Virginia
    MS-Off Ver
    2010
    Posts
    168

    Re: Image Lookup from Folder

    This work?

    Please Login or Register  to view this content.

  20. #20
    Forum Contributor
    Join Date
    10-13-2015
    Location
    Culloden, West Virginia
    MS-Off Ver
    2010
    Posts
    168

    Re: Image Lookup from Folder

    This work? I wasn't able to test it.

    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Re: Image Lookup from Folder

    Hi Jme

    I ran a command it's showing error

    Compile error
    Only comments may appear after end sub, end function or end property.

  22. #22
    Forum Contributor
    Join Date
    10-13-2015
    Location
    Culloden, West Virginia
    MS-Off Ver
    2010
    Posts
    168

    Re: Image Lookup from Folder

    Remove
    Please Login or Register  to view this content.

  23. #23
    Registered User
    Join Date
    01-08-2019
    Location
    Chennai, India
    MS-Off Ver
    2010
    Posts
    35

    Re: Image Lookup from Folder

    after removed Option explicit

    Data was updated But Not showing a image what i can do for that ??

  24. #24
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Image Lookup from Folder

    @Raj.xls

    For information : Option Explicit
    - Option Explicit is placed at the TOP of the module (before any procedures)
    - it forces you to always declare variables

    Your questions
    You were given code, you tested it, it worked. You then asked for 2 bits of code to be combined
    Why did you not do what I suggested in post#14? instead of adding extra precudures?

    It should work using post#14 version of Worksheet_Change
    - test with only Worksheet_Change and InsertPic procedures in the module
    - if it does not work, post that code and I will look at it for you

    This is all you should have in the module
    Please Login or Register  to view this content.
    Last edited by kev_; 02-19-2019 at 08:49 AM.

+ 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. Exporting selected image to a folder
    By ciapul12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-07-2018, 10:00 AM
  2. Vlookup into an image folder and importing the image into the spreadsheet?
    By talan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-30-2017, 12:54 PM
  3. Search Image from a Folder
    By Aikuchi in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-21-2015, 07:14 PM
  4. [SOLVED] (VBA) Insert image from a folder
    By Zgoda in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2015, 12:02 PM
  5. [SOLVED] Image folder
    By fitkhan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-19-2014, 07:26 PM
  6. [SOLVED] Lookup folder from cell text, then save excel file in this folder
    By dodgybob in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2014, 09:00 AM
  7. Export Image to folder as .gif
    By cman_c in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-04-2009, 05:07 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