Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saveas csv in excel

Status
Not open for further replies.

tlaksh

Programmer
Feb 25, 2001
98
US
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.
 
Try this:
objExcel.DisplayAlerts = False

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top