habe ein neues Laptop mit Windows 11 und Excel-Build 2209 bekommen, nun taucht bei bisher problemlos laufenden Dateien immer wieder ein Fehler auf wenn das Screenupdating ein- bzw. ausgeschaltet werden soll. Die Datei läuft seit vielen Jahren bei uns im Betrieb, Coding das zum Fehler führt sieht so aus:
Public Sub AllesAus()
Call Verarbeitung_EinAus(0, 0, 0, 0)
ThisWorkbook.Unprotect
End Sub
Public Sub AllesEin()
Call Verarbeitung_EinAus(1, 1, 1, 1)
ThisWorkbook.Protect , True, False
End Sub
Public Sub Verarbeitung_EinAus(btScreen As Byte, btEvent As Byte, btCalc As Byte, btAlert As Byte)
'ScreenUpdating
If btScreen = 0 Then
Application.ScreenUpdating = False 'Hier kommt der Fehler
Else
Application.ScreenUpdating = True
End If
'Events
If btEvent = 0 Then
Application.EnableEvents = False
Else
Application.EnableEvents = True
End If
'Calculation
If btCalc = 0 Then
Application.Calculation = xlCalculationManual
Else
Application.Calculation = xlCalculationAutomatic
End If
'Alerts
If btAlert = 0 Then
Application.DisplayAlerts = False
Else
Application.DisplayAlerts = True
End If
End Sub
Aufruf erfolgt dann z. B. vor dem Speichern oder Beenden von Excel.Hat jemand eine Idee oder Ansatz für mich?
Danke & VG, Heli