Link to home
Start Free TrialLog in
Avatar of brigham
brigham

asked on

Create hyperlink to searchfile result

I have an excel spreadsheet with over 7000 names of image files (TIF and JPG) on our server contributed by scientists around the world.  I would like to write a VBA macro to hyperlink the file name on the Excel worksheet "index" to the files.  All of the files are in the same directory, but scattered into many subfolders.  I have written a "searchfile" macro to that takes the content of the Excel cell and finds the appropriate file.  The problem is that there is a variable file path and the files have different extensions (mostly TIF and JPG).  Any suggestions would be greatly appreciated. thanks, Brigham
ASKER CERTIFIED SOLUTION
Avatar of [ fanpages ]
[ fanpages ]

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brigham
brigham

ASKER

Thanks for your comments.  I'm still stuck on how to point to the results of FileSearch.  You refer to "c:\my folder\file.tif" but in my case, I'm searching for the file.  I'm confident of the name, but not the path or the file extension (TIF or JPG).  For example,

Set fs = Application.FileSearch
With fs
     .LookIn = "D:\Images"
     .SearchSubFolders = True
     .FileName = MyFile
End With

FileSearch finds the file, but does it provide an address for the hyperlink?  Thanks, b
Avatar of brigham

ASKER

The "FoundFiles" object gave me the path and file extension.
Hi,

Do you need any further assistance?

BFN,

fp.
Thank you once again.
fanpages,
While I appreciate the thanks, please be aware that whenever there is a comment posted after the recommendation, it takes the Moderator a few extra keystrokes to finalize the Q.  Again, I appreciate the gesture, but if you don't have an objection to the recommendation, it is slightly better for the Cleanup Crew if you don't post.  I'm fine with assuming that you have thanked me in your heart :-)
-- Dan
OK, noted Dan, thank you... and apologies for this (final) comment :)