View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JI[_2_] JI[_2_] is offline
external usenet poster
 
Posts: 11
Default Convert every xls file in a folder to csv

Andrew and MArk thanks everything works great now.


Andrew Taylor wrote:
This is probably because it's looking in the wrong directory: the
FIleNames() array doesn't contain the full path, so VBA is trying
to find it in whatever it thinks is the current directory. Try

Workbooks.Open FileName:=ThisWorkbook.Path & "\" & FileNames(i)


JI wrote:
I am getting an error at this part:

Workbooks.Open FileName:=FileNames(i)

the message is that it cant find the file and to make sure the
directory or name hasn't changed, it has the file name included in the
message. I think the code works to collect and store all the files, it
just is having problem going back to the list to open the files.