Try something like this:
Dim wb As Workbook
Set wb = xlApp.Workbooks.Open(Temp_File)
. . .
wb.SaveAs Output_File
wb.Close
xlApp.Workbooks.Close
xlApp.Quit
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Trying to save a modified spreadsheet within access VBA does not work
Code sample:
Output_File = "c:\temp\test.xlsx"
xlApp.workbooks.Open (Temp_File) ***Work no problems
With xlApp.Worksheets("Sheet1") ***Work no problems
.Range("A1).Value = "Spreadsheet title" ***Work no problems
end with
xlApp.workbooks.Close SaveChanges:=TRUE, Output_File *** Syntax error
What should be the syntax for this command to execute without problems
I also try xlApp.workbooks.Close (TRUE, Output_File) *** syntax error
Try something like this:
Dim wb As Workbook
Set wb = xlApp.Workbooks.Open(Temp_File)
. . .
wb.SaveAs Output_File
wb.Close
xlApp.Workbooks.Close
xlApp.Quit