Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
424to428
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
424to428
424to428
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Prob with save/close. How to force it ?

Prob with save/close. How to force it ?
09.05.2004 18:52:47
Greg
Hi,
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

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Prob with save/close. How to force it ?
09.05.2004 19:06:49
DieterB
Hi Greg,
maybe the Workbook where the 2nd Macro is running is not active?
You're opening the 2nd WB, but is it active too?
kind regards
DieterB
AW: Prob with save/close. How to force it ?
NE
Hi Greg,
just a test, try this one:

Sub Macro1()
SetAttr "G:\XXX\Example.xls", vbNormal
Workbooks.Open Filename:= _
"G:\XXX\Example.xls"
Application.Run ("Example.xls!SecondMacro")
ActiveWorkbook.Save
ActiveWindow.Close
End Sub

cu Nancy

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige