AW: nur das userform anzeigen
26.06.2008 14:29:00
Matthias
Hallo Polarfuchs,
ohne EXE-Datei (also ohne VB) geht das z.B. so:
In "DieseArbeitsmappe":
Private Sub Workbook_Activate()
If Workbooks.Count = 1 Then Application.Visible = False
End Sub
Private Sub Workbook_Deactivate()
If Workbooks.Count > 1 Then Application.Visible = True
End Sub
Private Sub Workbook_Open()
UserForm1.Show vbModeless
End Sub
Ins Modul des Userforms:
Private Sub CommandButton1_Click() 'Button zum Schließen des UFs
Unload Me
If Workbooks.Count > 1 Then 'ist noch eine Arbeitsmappe geöffnet?
Application.Visible = True
ThisWorkbook.Close True ' Beende Mappe und speichere sie vorher ab
Else
If Not ThisWorkbook.Saved Then ThisWorkbook.Save
Application.Quit
End If
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then Cancel = True
End Sub
Ob du die Mappe beim Beenden speichern willst oder nicht, oder erst nach Rückfrage, müsstest du noch festlegen, aber von Prinzip funktioniert es wie oben gezeigt.
Gruß Matthias