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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open excel docs from a folder

Status
Not open for further replies.

Malc8179

MIS
Oct 8, 2007
28
GB
Hi Guys

I have 980 excel docs in a folder i want to run a script in excel that will open each file in turn copy the file name store the the file name in a list

im able to copy the file name and store the file name i am stuck with opening the files from the folder in turn
 
Have a look at the Dir function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Look at the Dir() function in VBA.
If you have Excel files in C:\My Folder then do something like:

Dim strFile as String
strFile = Dir("C:\My Folder\*.xls") 'returns first file

Do While strFile <> ""
strFile=Dir 'note no parameter
loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top