Overwrite existing File when exporting to Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a Macro to OutputTo excel. I am getting the pop up message that xxxx
file already exists, do you want to overwrite.
I saw another post in this newsgroup that said to use the "SendKeys"
function to get around this. I tried to add that in and I typed the left
arrow key and the enter key (to move active over the YES box and hit enter),
but I am still getting the pop up.
I converted the macro to VBA and attached below... maybe you can tell me
what I am missing? :-)
Thanks!


Option Compare Database

'------------------------------------------------------------
' Cases_Closed_Comments1
'
'------------------------------------------------------------
Function Cases_Closed_Comments1()
On Error GoTo Cases_Closed_Comments1_Err

DoCmd.OpenQuery "Cases Closed Query - Weekly Comments", acViewNormal,
acEdit
DoCmd.SetWarnings False
DoCmd.Hourglass True
DoCmd.OutputTo acQuery, "Cases Closed Query - Weekly Comments",
"HTML(*.html)", "S:\Groupcast Solution Services\Weekly Comments.htm", False,
"", 0
SendKeys "", True
DoCmd.Close , ""


Cases_Closed_Comments1_Exit:
Exit Function

Cases_Closed_Comments1_Err:
MsgBox Error$
Resume Cases_Closed_Comments1_Exit

End Function
 
Back
Top