Untenstehender Code läuft in Excel 9.0 super, in Excel 8.0 wird bei cmd-Button-Click keine Aktion durchgeführt, wenn eine andere Arbeitsmappe geöffnet ist. Schliesse ich meine Mappe über Schliesskreuz, wird die andere Mappe ebenfalls geschlossen.
Muss der Code in Excel 8.0 anders lauten ?
Gruß
Lutz
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Worksheets("Start").Visible = True Then
ActiveWorkbook.Saved = True
GoTo 12
End If
Dim wks
Worksheets("Start").Visible = True
For Each wks In ActiveWorkbook.Sheets
If wks.Name = "Start" Then
wks.Visible = True
Else
wks.Visible = xlVeryHidden
End If
Next
12 If Workbooks.Count = 1 Then Application.Quit
If Workbooks.Count > 1 Then ThisWorkbook.Close
End Sub