Overwrite existing File when OutputTo Excel

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

Guest

In my Macro to export Access data to Excel, I am getting the pop-up message
that my xxx file already exists, do you want to overwrite it. I saw in
another post on this newsgroup, that someone suggested using the "SendKeys".
I tried to add that in and hit the left arrow and enter keys (for those to be
the keys that get sent - to move focus over the YES button and then accept),
but it is still not working.
I have posted the macro, converted to VBA, below... Can anyone see what I am
doing wrong?
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