online 1
gast (50)

/ Forum / Textverarbeitung

TextverarbeitungTextverarbeitung

Fragevon maxim66 vom 10.06.2020, 10:25 Options

Das Schließen verhindern/abbrechen

Hallo,

ich suche nach einer Möglichkeit das Schließen der Word-Datei abzubrechen. In Excel gibt es ein Ereignis:
Sub Workbook_BeforeClose(Cancel As Boolean)
    Cancel = True
End Sub
Hat jemand ein ähnliches Beispiel für Word?


Antwort schreiben

Antwort 1 von stirlitz vom 10.06.2020, 10:49 Options

Hallo maxim66,

Mit folgendem Code muss es gehen. Kopiere ihn in das Klassenmodul "ThisDocument"
Private WithEvents wrdApp As Word.Application

Private Sub Document_New()
  If wrdApp Is Nothing Then Set wrdApp = ThisDocument.Application
End Sub

Private Sub Document_Open()
  If wrdApp Is Nothing Then Set wrdApp = ThisDocument.Application
End Sub

Private Sub wrdApp_DocumentBeforeClose(ByVal Doc As Document, Cancel As Boolean)
    Cancel = True
End Sub

Gruß stirlitz

Ähnliche Themen

Fehlermeldung im IE 7 beim Schließen des Browsers
imebro  04.09.2007 - 12 Hits - 1 Antwort

Norton I-net Security Systemprüfung hängt
DLGB  21.09.2007 - 16 Hits - 1 Antwort

Hinweis

Diese Frage ist schon etwas älter, Sie können daher nicht mehr auf sie antworten. Sollte Ihre Frage noch nicht gelöst sein, stellen Sie einfach eine neue Frage im Forum..

Neue Einträge

Version: supportware 1.9.150 / 10.06.2022, Startzeit:Mon Jan 26 01:23:17 2026