+ Reply to Thread
Results 1 to 4 of 4

VBA - Insert picture into cell using wildcards

  1. #1
    Registered User
    Join Date
    05-21-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    25

    VBA - Insert picture into cell using wildcards

    Hi all,

    Desperate for some help, been scouring the internet for ages and just cannot find what I need.

    I have basically created a document in excel which provides our customer with all the information they need along with a .jpg image of a signature.

    The images are saved in folders which are dependant on when the signature was taken, for that reason I have several variables.

    The file path which always remains the same is "\\ENTAP08\PDA Attachment Storage\PROD\"

    Then follows the year folder which is in A1
    Then the date folder which is A2
    Then the known part of the filename which is A3

    and the rest is unknown (time stamped in seconds, time delay for the upload to our network unfortunately makes it impossible for us to know the exact time)

    So what I will end up with is the following: "\\ENTAP08\PDA Attachment Storage\PROD\2017\20170320\task_id2690223"

    Whereas the full file name may be: "\\ENTAP08\PDA Attachment Storage\PROD\2017\20170320\task_id2690223__customer_sign20170326112329.jpg"

    I have pulled together the below code but cannot get it to work. I would greatly appreciate any advice which can be offered.

    Please Login or Register  to view this content.
    I managed to get it to work if I removed the wildcard and manually put the filename (as a test) and it worked fine, just need it to account for the wildcard. Im either very close or very far away

    Many thanks
    Dan

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: VBA - Insert picture into cell using wildcards

    Hi ddbroadhead92,

    You were both close and far away at the same time. The wildcard belongs in the 'Dir()' command. Dir() either returns the file name only or a NULL STRING. If the Dir() result is a file name, the path has to be prepended to the matching file name to access the file.

    Try the following code:
    Please Login or Register  to view this content.
    Lewis
    Last edited by LJMetzger; 07-03-2017 at 01:39 PM. Reason: removed line of code used for debugging

  3. #3
    Registered User
    Join Date
    05-21-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    25

    Re: VBA - Insert picture into cell using wildcards

    Hi Lewis,

    Thankyou for the response and the explanation, I found that it returned the "No matching file" when I tried to run it.

    After looking through the code, I removed

    Please Login or Register  to view this content.
    and it seems to work fantastically now! Very pleased.

    Thank you for your help I was beginning to lose my mind!

    Many Thanks
    Dan

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: VBA - Insert picture into cell using wildcards

    Hi Dan,

    I'm glad I was able to help, and thanks for the rep points. Sorry about the debugging line of code I forgot to remove.

    Lewis

+ 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] Insert Picture in cell, click commanbutton to rename picture, lock cell and remove button
    By thecdnmole in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-28-2014, 10:05 PM
  2. Insert Picture To Cell in Col A with pic name in Col B
    By EBTI in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-07-2014, 07:57 AM
  3. How to insert a picture into a cell
    By VickiFletcher in forum Excel General
    Replies: 3
    Last Post: 04-28-2014, 10:29 AM
  4. VBA for Picture insert at particular worksheet range. Picture name derived from cell.
    By Douglas2013 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2013, 01:16 AM
  5. Insert Picture into cell
    By tomlancaster in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-23-2009, 10:04 PM
  6. Insert picture when cell changes
    By Rookie_User in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-22-2006, 03:45 AM
  7. how can I insert a picture in a cell
    By yakmelk in forum Excel General
    Replies: 2
    Last Post: 11-03-2005, 04:25 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