<!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:AllowPNG/> </o:OfficeDocumentSettings> </xml><![endif]--> Hello everybody,
I recently run into a problem with workbook_open.
The code has been successfully running for years.
Now if I open the file nothing happens. Or almost always nothing happens. Sometimes (rarely) it does still work. Unfortunately I cannot reproduce it.
I believe the problem started when I experimented with EnableEvents=True/False in another procedure.
Any help is highly appreciated.
M.
Here is the code:
There are no other macros in the workbook!
The Sub Sichern itself is working.
The Range("Backup_Pfad") and Range("Dateipfad") refer to cells within the workbook that contain (actually calculate) the filename and location.
Here is a link to the file:
https://1drv.ms/x/s!AlTXI0a7_oHihtNjzUUJzLk5wklAxw
I recently run into a problem with workbook_open.
The code has been successfully running for years.
Now if I open the file nothing happens. Or almost always nothing happens. Sometimes (rarely) it does still work. Unfortunately I cannot reproduce it.
I believe the problem started when I experimented with EnableEvents=True/False in another procedure.
Any help is highly appreciated.
M.
Here is the code:
Code:
Private Sub Workbook_Open()
Call Sichern
End Sub
Sub Sichern()
Application.Calculate
antwort = MsgBox("Backup?", vbYesNo, "Backup?")
If antwort = vbYes Then
'Speichern unter Backup-Dateinamen
ThisFile = Range("Backup_Pfad").Value
ActiveWorkbook.SaveAs FileName:=ThisFile, ReadOnlyRecommended:=True
'Speichern unter altem Dateinamen
'Dabei wird die Datei überschrieben
'Damit keine Eingabeaufforderung erscheint werden die Alerts ausgeschalten
Application.DisplayAlerts = False
ThisFile = Range("Dateipfad").Value
ActiveWorkbook.SaveAs FileName:=ThisFile, ReadOnlyRecommended:=False
Application.DisplayAlerts = True
MsgBox "Backup saved!", vbOKOnly
End If
End Sub
The Sub Sichern itself is working.
The Range("Backup_Pfad") and Range("Dateipfad") refer to cells within the workbook that contain (actually calculate) the filename and location.
Here is a link to the file:
https://1drv.ms/x/s!AlTXI0a7_oHihtNjzUUJzLk5wklAxw
Last edited by a moderator: