G
Guest
I have a macro that saves data to an excel file. When I run the macro "excel
database" it works great. It comes up with a box asking if I want to
overwrite the file and I say yes. However, when I add a command button to my
form to run the macro, it doesn't run. I'm assuming that it's because it's
not giving me the box asking me if I want to overwrite the existing file.
What line do I put in my macro to do that. Here's the current language
Private Sub Command104_Click()
On Error GoTo Err_Command104_Click
Dim stDocName As String
stDocName = "Excel Database"
DoCmd.RunMacro stDocName
DoCmd.Close
Exit_Command104_Click:
Exit Sub
Err_Command104_Click:
MsgBox Err.Description
Resume Exit_Command104_Click
End Sub
Thanks for any help you can give.
database" it works great. It comes up with a box asking if I want to
overwrite the file and I say yes. However, when I add a command button to my
form to run the macro, it doesn't run. I'm assuming that it's because it's
not giving me the box asking me if I want to overwrite the existing file.
What line do I put in my macro to do that. Here's the current language
Private Sub Command104_Click()
On Error GoTo Err_Command104_Click
Dim stDocName As String
stDocName = "Excel Database"
DoCmd.RunMacro stDocName
DoCmd.Close
Exit_Command104_Click:
Exit Sub
Err_Command104_Click:
MsgBox Err.Description
Resume Exit_Command104_Click
End Sub
Thanks for any help you can give.