I am using MS Access 2013 and am using VBA and late binding (No Excel Reference in VBA) to take an Excel file perform some processes and then Save As a CSV file. Everything works as desired except the Save As portion.
Dim db As DAO.Database
Dim RS As DAO.Recordset
Dim RS2 As DAO.Recordset
Dim RS3 As DAO.Recordset
Dim Grid As String
Dim GridN As Integer
Dim GridTotal As String
Dim CIISname As String
Dim objexcel_app As Object
Dim xlsExcel_wkbook As Object
Dim xlsExcel_sheet As Object
Dim xlsExcel_range As Object
Set objexcel_app = CreateObject("Excel.Application")
objexcel_app.Visible = False
Set xlsExcel_wkbook = objexcel_app.Workbooks.Open("C:\Deal\New_NMTC_TLR_Note.xls")
Set xlsExcel_sheet = xlsExcel_wkbook.sheets("New_NMTC_TLR_Note")
Set db = CurrentDb
objexcel_app.DisplayAlerts = False
xlsExcel_sheet.Cells(5, 5).EntireRow.Delete
objexcel_app.activeworkbook.Save
'Here is where the problem is, I have tried different combinations of the 2 lines below (never both at the same time). Both lines will not compile and gets hung up on the FileFormat:=xlCSV as a not recognized variable. I have also tried including FileFormat:=xlCSVWindows. That didn't work either. Any suggestions would help. I also have tried using a Procedure on the web called ConvertXls2CSV which appeared to work fine until I noticed it stripped some leading zeros of column because it was treating a string as numeric so I don't trust using it.
xlsExcel_wkbook.SaveAs FileName:="C:\deal\New_NMTC_TLR_Note.csv", FileFormat:=xlCSV, CreateBackup:=False
objexcel_app.activeworkbook.SaveAs FileName:="C:\deal\New_NMTC_TLR_Note.csv", FileFormat:=xlCSV, CreateBackup:=False
objexcel_app.activeworkbook.Close
objexcel_app.Quit
Set objexcel_app = Nothing
Set xlsExcel_wkbook = Nothing
Set xlsExcel_sheet = Nothing
Set xlsExcel_range = Nothing
Dim db As DAO.Database
Dim RS As DAO.Recordset
Dim RS2 As DAO.Recordset
Dim RS3 As DAO.Recordset
Dim Grid As String
Dim GridN As Integer
Dim GridTotal As String
Dim CIISname As String
Dim objexcel_app As Object
Dim xlsExcel_wkbook As Object
Dim xlsExcel_sheet As Object
Dim xlsExcel_range As Object
Set objexcel_app = CreateObject("Excel.Application")
objexcel_app.Visible = False
Set xlsExcel_wkbook = objexcel_app.Workbooks.Open("C:\Deal\New_NMTC_TLR_Note.xls")
Set xlsExcel_sheet = xlsExcel_wkbook.sheets("New_NMTC_TLR_Note")
Set db = CurrentDb
objexcel_app.DisplayAlerts = False
xlsExcel_sheet.Cells(5, 5).EntireRow.Delete
objexcel_app.activeworkbook.Save
'Here is where the problem is, I have tried different combinations of the 2 lines below (never both at the same time). Both lines will not compile and gets hung up on the FileFormat:=xlCSV as a not recognized variable. I have also tried including FileFormat:=xlCSVWindows. That didn't work either. Any suggestions would help. I also have tried using a Procedure on the web called ConvertXls2CSV which appeared to work fine until I noticed it stripped some leading zeros of column because it was treating a string as numeric so I don't trust using it.
xlsExcel_wkbook.SaveAs FileName:="C:\deal\New_NMTC_TLR_Note.csv", FileFormat:=xlCSV, CreateBackup:=False
objexcel_app.activeworkbook.SaveAs FileName:="C:\deal\New_NMTC_TLR_Note.csv", FileFormat:=xlCSV, CreateBackup:=False
objexcel_app.activeworkbook.Close
objexcel_app.Quit
Set objexcel_app = Nothing
Set xlsExcel_wkbook = Nothing
Set xlsExcel_sheet = Nothing
Set xlsExcel_range = Nothing