Hi guys
Everytime when i run the following code then a message appears
"cc1.xls is a Microsoft Excel 5.0/95 workbook. Do you want to overwrite it with latest excel format,yes,no,cancel"
how can i avoid this message from appearing.
Cheers
Everytime when i run the following code then a message appears
"cc1.xls is a Microsoft Excel 5.0/95 workbook. Do you want to overwrite it with latest excel format,yes,no,cancel"
Code:
private sub save1()
strsql = "SELECT inputtable.[Date] as [Date],inputtable.Location as SourceLoc,inputtable.Department as SourceDept,inputtable.Barcode as Barcode,rebookinfo.date1 as RebookDate,rebookinfo.location as RebookLoc,rebookinfo.Department as RebookDept FROM inputtable,rebookinfo WHERE inputtable.barcode=rebookinfo.barcodevalue order by barcode,rebookinfo.date1;"
If DCount("Name", "MSysobjects", "Name='qrytemp' and type=5") > 0 Then
DoCmd.DeleteObject acQuery, "qrytemp"
End If
Set qdf = CurrentDb.CreateQueryDef("qrytemp", strsql)
Dim objXls As Excel.Application
Dim objWrkBk As Excel.Workbook
Dim xprtFile As String
xprtFile = "C:\Documents and Settings\Amanpreet Kaur\Desktop\cc1.xls"
DoCmd.OutputTo acOutputQuery, "qrytemp", acFormatXLS, xprtFile, False
Set objXls = New Excel.Application
objXls.Visible = False
Set objWrkBk = objXls.Workbooks.Open(xprtFile)
Set objWrkBk = objXls.Workbooks.Open(xprtFile)
objWrkBk.Sheets("qrytemp").Select
With objWrkBk.Sheets("qrytemp")
.Application.Rows("1:1").Select
.Application.Selection.Font.Bold = True
'.Quit
End With
objWrkBk.Close SaveChanges:=True
Set objWrkBk = Nothing
objXls.Quit
Set objXls = Nothing
Set qdf = Nothing
end sub
how can i avoid this message from appearing.
Cheers