Hi all
I'm trying to open an Excel file from within Access, then save the file back as a csv.
I'm currently using the following code...
When I run the code, my workbook opens but doesn't appear to do anything else. If I remove the FileFormat argument from my SaveAs it saves the workbook successfully (but not as a csv).
Any ideas?
Thanks in advance.
I'm trying to open an Excel file from within Access, then save the file back as a csv.
I'm currently using the following code...
Code:
Private Sub RunExcel()
Dim xlApp, xlBook As Object
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add("X:\MyWorkbook.xls")
xlApp.Visible = True
xlBook.SaveAs FileName:="X:\MyWorkbook.csv", FileFormat:=xlCSV
Set xlApp = Nothing
Set xlBook = Nothing
End Sub
When I run the code, my workbook opens but doesn't appear to do anything else. If I remove the FileFormat argument from my SaveAs it saves the workbook successfully (but not as a csv).
Any ideas?
Thanks in advance.