Active directory

  • Thread starter Thread starter David
  • Start date Start date
Hello Per,

I thought all I needed was what you provided to do what I wanted to do,
which is to open all the files in the current directory. This is what I was
hoping would work, but it is not:

Sub OpenAllFiles()
'David Lanman 5/2/2009
Dim strFile
Dim strFolder
strFolder = ActiveWorkbook.Path
strFolderSave = ActiveWorkbook.Path
strFile = Dir(strFolder & "*.*", vbNormal)
Do While strFile <> ""
MsgBox strFile
Workbooks.Open Filename:= _
strFolder & strFile
'do something
ActiveWorkbook.SaveAs Filename:= _
strFolderSave & "/" & strFile
ActiveWorkbook.Close
strFile = Dir
Loop
End Sub

The strFile is empty. There is extra code, in that when I save it will be to
the same directory.

Thanks for your help,
David
 
Back
Top