Find and open workbook

Tall

New Member
Joined
Jul 16, 2002
Messages
28
Hi!!

I have a worksheet that contains a number of cells with object_ID’s.
This object_ID is also a part of a filename stored on a disk. How do I find this file, and open the file containing the object_ID?
Since the object_ID is unique there is only one file to find and open. The files are stored in different folders.
I hope that some of you have some code that could help me


Regards from
Tall
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Tazguy37

MrExcel MVP
Joined
May 28, 2004
Messages
4,237
The FileSearch Object could do that for you. From the VBA help file:

Code:
With Application.FileSearch
    .NewSearch
    .LookIn = "C:\My Documents"
    .SearchSubFolders = True
    .FileName = "Run"
    .MatchTextExactly = True
    .FileType = msoFileTypeAllFiles
End With

Using that as a template, you should be able to do it. I'd need more data, though, if you need more help (what folders(s), what the filename looks lie...). Hope that helps!
 
Upvote 0

Forum statistics

Threads
1,195,635
Messages
6,010,829
Members
441,569
Latest member
PeggyLee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top