Hi
I have 214 xlsx files i need to convert to csv format for mapping in another program
ive been searching forums etc for a day and more and have got some code that looks as if it should work, but i'm pretty new to this so it could be totally wrong.
ultimately i want to code to get all of the files in the xls folder and make csv versions with the same filename.
anyway, its failing on Workbooks.Open Filename:=MyFileName
here is the code
thanks in advance for for any help! Im sure this is a very simple fix
Matt
I have 214 xlsx files i need to convert to csv format for mapping in another program
ive been searching forums etc for a day and more and have got some code that looks as if it should work, but i'm pretty new to this so it could be totally wrong.
ultimately i want to code to get all of the files in the xls folder and make csv versions with the same filename.
anyway, its failing on Workbooks.Open Filename:=MyFileName
here is the code
Code:
Sub LoopFiles()
Dim MyFileName, MyPath As String
Dim MyBook As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
MyPath = "D:\ArcGis_Projects\Elephants\csv\xls\"
MyFileName = Dir(MyPath & "*.xlsx")
Do Until MyFileName = ""
Workbooks.Open Filename:=MyFileName
ChDir "D:\ArcGis_Projects\Elephants\csv_dm"
ActiveWorkbook.SaveAs Filename:=MyFileName, FileFormat:=xlCSV, CreateBackup:=False
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
thanks in advance for for any help! Im sure this is a very simple fix
Matt