Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select filenames fast from a folder's multitude 1

Status
Not open for further replies.

EddyH

Technical User
Jan 22, 2004
7
GB
I have a multitude of files within a folder being pdf and Excel.

They are identified by their leading 3 characters ie ZZf....xls. Ideally only one Excel file will match ZZf in that folder.

I want to quickly get the filename inside that folder matching ZZf so I can use it later. Doing this via VBA as have a few hundred to do. ABf,ARf,BBf etc.

I guess I want the standard 'file open' with its 'find files' option' dialog box you get manually but macro recorder just gives me final file open choice. Hopefully vba can avoid actual dialog and handle error when ZZf finds no files or multiple files.

Any ideas?
 
type:
filesystemobject

into the VBA help - should give you some pointers of where to start

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
And what about Dir("??f*.xls") ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top