I have the following code on the click event of a command button in Access. It works fine except there are messages that pop up in excel regarding overwriting and saving in CSV format. Is there a way to supress these messages?
===========================================================
Private Sub Command23_Click()
Dim filename As String
Dim Newfilename As String
filename = "B:\PR_DLR_T_" & Text21.Value & ".xls"
Newfilename = "B:\PR_DLR_T_" & Text21.Value & ".csv"
DoCmd.OutputTo acOutputQuery, "Dollars", acFormatXLS, filename, False
Dim objExcel As New Excel.Application
With objExcel
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open filename
objExcel.ActiveWorkbook.SaveAs Newfilename, xlCSVWindows
objExcel.Application.Quit
End With
Set objExcel = Nothing
filename = " "
End Sub
============================================================
Thanks
Lakshmi.
===========================================================
Private Sub Command23_Click()
Dim filename As String
Dim Newfilename As String
filename = "B:\PR_DLR_T_" & Text21.Value & ".xls"
Newfilename = "B:\PR_DLR_T_" & Text21.Value & ".csv"
DoCmd.OutputTo acOutputQuery, "Dollars", acFormatXLS, filename, False
Dim objExcel As New Excel.Application
With objExcel
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open filename
objExcel.ActiveWorkbook.SaveAs Newfilename, xlCSVWindows
objExcel.Application.Quit
End With
Set objExcel = Nothing
filename = " "
End Sub
============================================================
Thanks
Lakshmi.