Our forums are currently in maintenance mode and the ability to post is disabled. We will be back up and running as soon as possible. Thanks for your patience!


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

By ACatK ·
Tags: Microsoft
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

Function HLinkTrueFalse(path As String) As Boolean
If Dir(path) <> vbNullString Then HLinkTrueFalse = True
End Function
Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums