Hi all,
I'm using the below code on a button click on my form. The code works by opening an existing spreadsheet and formats it. How do i get rid of the nagging prompt "Do you want to save the changes" when the the code executes? Thanks
' Open up the spreadsheet
Set xlapp = CreateObject("Excel.Application")
xlapp.Application.Visible = False
xlapp.workbooks.Open (ExportDir & ExportFile)
Set xlwkb = xlapp.Application.ActiveWorkbook
' Set overall font to Arial, 8pt
xlapp.Cells.Select
xlapp.Selection.Font.Name = "Arial"
xlapp.Selection.Font.Size = "8"
' Now put row headings to bold
xlapp.Application.Rows("1:1").Select
With xlapp.Application.Selection.Font
.Bold = True
End With
' Now autofit columns
xlapp.Cells.Select
xlapp.Selection.columns.AutoFit
xlapp.Application.Rows("1:1").Select
DoCmd.SetWarnings False
' Save and close the spreadsheets
xlapp.ActiveWorkbook.Save
xlapp.ActiveWorkbook.Close
I'm using the below code on a button click on my form. The code works by opening an existing spreadsheet and formats it. How do i get rid of the nagging prompt "Do you want to save the changes" when the the code executes? Thanks
' Open up the spreadsheet
Set xlapp = CreateObject("Excel.Application")
xlapp.Application.Visible = False
xlapp.workbooks.Open (ExportDir & ExportFile)
Set xlwkb = xlapp.Application.ActiveWorkbook
' Set overall font to Arial, 8pt
xlapp.Cells.Select
xlapp.Selection.Font.Name = "Arial"
xlapp.Selection.Font.Size = "8"
' Now put row headings to bold
xlapp.Application.Rows("1:1").Select
With xlapp.Application.Selection.Font
.Bold = True
End With
' Now autofit columns
xlapp.Cells.Select
xlapp.Selection.columns.AutoFit
xlapp.Application.Rows("1:1").Select
DoCmd.SetWarnings False
' Save and close the spreadsheets
xlapp.ActiveWorkbook.Save
xlapp.ActiveWorkbook.Close