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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File exist : No Ask for overwrite

Status
Not open for further replies.

matrixknow

IS-IT--Management
May 3, 2007
78
Hola,

I create files from access to excel. However when the file already exist, he may overwrite it without asking. I wan't to avoid the anoying ask "the file exist, may I overwrite it". Is a docmd.setwarning false enough to fix this ?
 
What code are you using to create the Excel file?
 
Code:
xlWorkSheet.Cells(iRow, iCol).EntireColumn.AutoFit
            iFld = iFld + 1
         End If

      Next
      iRow = iRow + 1
      rst1.MoveNext
   Loop
   
   xlWorkSheet.PageSetup.Orientation = xlLandscape
   DoCmd.SetWarnings False
   xlWorkBook.SaveAs strOutput
   xlWorkBook.Close

not the way of docmd ...
 
Replace this:
DoCmd.SetWarnings False
with this:
xlWorkBook.Application.DisplayAlerts = False

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
thanks PHV, this was a quick and correct answer. It works and I see now that I should use the statements of excel in this case.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top