View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dutch76[_2_] Dutch76[_2_] is offline
external usenet poster
 
Posts: 4
Default Opening Excel-files in several directories

Bob Philips gave me the solution (see hereunder) to open Excel-files in a
certain directory. Is it also possible to change the directory after
finishing this and restart the job from the beginning? In other words: is it
possible to change the line
"sFile = Dir("C:\TestFolders\*.xls", vbNormal)" into
"sFile = Dir("C:\TestFolders2\*.xls", vbNormal)" by a For..Next loop?

Dim sFile As String
sFile = Dir("C:\TestFolders\*.xls", vbNormal)
If sFile < "" Then
Do
'Do your stuff
Debug.Print sFile
sFile = Dir


Loop Until sFile = ""
End If