View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Andrew Taylor Andrew Taylor is offline
external usenet poster
 
Posts: 225
Default Convert every xls file in a folder to csv

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.