workbook_open stopped working

MLExcel

New Member
Joined
Nov 1, 2016
Messages
24
<!--[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:

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
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
 
Last edited by a moderator:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top