VBA Excel schließt die Datei
29.08.2017 05:26:56
Roland
mit diesem Code Schließt Excel und speichert vorher. Bis jetzt ist ist der Code ganz gut.
Leider ist aber das Problem, das wenn man in der Zelle drin ist, das der Code nicht mehr funktioniert.
Kann man es so einrichten, das man immer in 45 Sekunden herausfliegt und das dafür eine MSG Box kommt " in 10Sek. wird die Datei geschlossen" . Damit es übersichtlicher ist ?
kommt als Code in DieseArbeitsmappe
Option Explicit
Private Sub Workbook_Open()
Application.OnTime Now + TimeSerial(0, 0, 30), "Auto_Close_"
End Sub
kommt als Code in Modul1Option Explicit
Sub Auto_Close_()
Dim i%
For i = 10 To 1 Step -1
Application.StatusBar = "Excel wird in " & i & " Sek. geschlossen!"
Application.Wait Now + TimeSerial(0, 0, 1)
DoEvents
Next
Application.StatusBar = False
If Not ThisWorkbook.ReadOnly Or ThisWorkbook.Saved = False Then
ThisWorkbook.Save
If Application.Workbooks.Count Application.Quit
Else
ThisWorkbook.Close
End If
Else
If Application.Workbooks.Count Application.Quit
Else
ThisWorkbook.Close False
End If
End If
End Sub
Danke an Alle
Roland