Question

  • Creator
    Topic
  • #2143686

    Excel VBA-If partial match in file names, generate hyperlink

    by acatk ·

    Tags: 

    Hey Wizards,

    On Excel spreadsheet:
    A3 has a path to folder, like C:\Users\Auser\Documents\FolderA\
    Cells A6 & down have a list of values, like 00K12345 per cell

    Folder from path in A3 has files named as such: 12 201**002 ABC123 00K12345.PDF

    Need: in corresponding cells in B6 & down:
    If value from A is found in one of the files in A3 folder
    Then generate hyperlink to it with value from A as friendly name
    Otherwise populate “Not found”

    So far only have the below code which returns true/false if link is valid, but obviously that doesn’t get it done

    Code:
    Function HLinkTrueFalse(path As String) As Boolean
    If Dir(path) <> vbNullString Then HLinkTrueFalse = True
    End Function

You are posting a reply to: Excel VBA-If partial match in file names, generate hyperlink

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our Community FAQs for details. All submitted content is subject to our Terms of Use.

All Answers

Share your knowledge