Hello,
I have some variables in Access that I would simply like to write to specific cells in an excel spreadsheet and save. I would like it to not prompt before it overwrites the previous file with the same name, and not open after it's saved. What code do I need to do this? Currently it saves out a new excel sheet, but it prompts before overwriting the one with the same name, and it opens the file after the save.
Here is what I have now:
Code:
Dim newExcelApp As excel.Application
Dim newWbk As excel.Workbook
Dim newWkSheet As excel.Worksheet
Set newExcelApp = excel.Application
newExcelApp.Visible = True
Set newWbk = newExcelApp.Workbooks.Add
Set newWkSheet = newWbk.Worksheets(1)
newWkSheet.Cells(1, 1).value = DataVariable
newWkSheet.Cells(2, 1).value = DataVariable
newWkSheet.SaveAs (FilePath)