Prob with save/close. How to force it ?
09.05.2004 18:52:47
Greg
I have a problem to close and save a workbook (ultra protected, made by some vba specialist. That s probably why i have that problem).
I am running the code below to open a second workbook, run a macro resident in that second workbook and then save and close it. However, the code breaks at the line "ActiveWorkbook.Save" with the Run-time error '1004': '[:]' cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be reponding.
The strange part is that once you enter the debugger, I can switch back to the Excel window and manually save/close the workbook with no issue.
Any ideas to force it to save and close without any message ?
Thanks for your help,
Greg
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Sub Macro1()
Workbooks.Open Filename:= _
"G:\XXX\Example.xls"
Application.Run ("Example.xls!SecondMacro")
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>