have been trying to set up an autosave
for the program I've been working on (which all of you have already
helped with a lot, already, thanks).
When I looked at the VBA help files (by the way, using Office
2003) and poked around on the web, including ozgrid
(http://www.ozgrid.com/Excel/run-macro-on-time.htm) as well as other
sites, I tried numerous ways to get it to work, and have not
succeeded yet.
The 1004 error I'm getting is in the ThisWorkBook code of:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnTime dTime, "autosavMacro", , Schedule:=False
End Sub
'<---which I understood was necessary to shut off the scheduled
'<---firing of the autosave, so the user could do other things
'<---that's what I understood from the ozgrid page mentioned above
Also involved is:
Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:05:00"), "autosavMacro"
End Sub
in a Standard module, I put:
Public dTime As Date
Sub autosavMacro()
dTime = Now + TimeValue("00:05:00")
Application.OnTime dTime, "autosavMacro"
'---and I tried: Application.OnTime dTime, "saveAllCallData"
Call saveAllCallData
End Sub
Of course, the problem with a 1004 error, is that it's hard to
see where exactly in the code is the problem. Ok, the method
failed . . . why? . . . heck if I know . . . I tried changing it
many ways, and even tried to run several versions of the code that I
had found online just pasted directly.
The saveAllCallData macro/subroutine works fine when called from
any other source, or when I just run it directly.
I did see the autosavMacro fire once. That's it, though. On the
close workbook/save attempts, though, keep hitting the 1004 error.
What am I missing? All suggestions will be appreciated.
Hope are of you are having a wonderful New Year, and as always
thanks for your help.