I'm having a strange problem. When I run a VBA script, Excel gives me an error message saying "run-time error '1004': incorrect function".
The strange thing is I repeatedly do everything consistently (open the xlsm, run the script which displays a userform, enter a date, the same date, that is all) and get the error one out of every four times (roughly), not every time.
If the problem is due to incorrect function, shouldn't I get the error every time?
Even stranger, if I add a msgbox right before the problem code, now, I consistently get the error message "incorrect funcction".
Any idea? Thanks.
================================
msgbox("activeworkbook name is " & ActiveWorkbook.Name) <- getting consistent error message if added
ActiveWorkbook.SaveAs Filename:=destinationPath & destinationFileName, FileFormat:= _
xlWorkbookDefault
'where destinationPath is "\\lenovo-pc1\d\deddem\" and
'destinationFileName is "test". I ran the script on lenovo-pc1.
The strange thing is I repeatedly do everything consistently (open the xlsm, run the script which displays a userform, enter a date, the same date, that is all) and get the error one out of every four times (roughly), not every time.
If the problem is due to incorrect function, shouldn't I get the error every time?
Even stranger, if I add a msgbox right before the problem code, now, I consistently get the error message "incorrect funcction".
Any idea? Thanks.
================================
msgbox("activeworkbook name is " & ActiveWorkbook.Name) <- getting consistent error message if added
ActiveWorkbook.SaveAs Filename:=destinationPath & destinationFileName, FileFormat:= _
xlWorkbookDefault
'where destinationPath is "\\lenovo-pc1\d\deddem\" and
'destinationFileName is "test". I ran the script on lenovo-pc1.