O
online.experiment
Dear Group,
I am a newbie in vba and tried to google a solution but couldnt
find....
I want to prevent the user to save (or ask if he really wants to
save).
The code works fine in Excel (VBAProject - ThisWorkbook), but not in
Word (Project - Microsoft Word Objects - ThisDocument) - see below...
How do I have to change the vba word code?
Thanks a lot,
Andreas
EXCEL: works!
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
a = MsgBox("Do you really want to save the workbook?", vbYesNo)
If a = vbNo Then Cancel = True
End Sub
WORD: doesn't work
Private Sub Document_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
a = MsgBox("Do you really want to save the workbook?", vbYesNo)
If a = vbNo Then Cancel = True
End Sub
I am a newbie in vba and tried to google a solution but couldnt
find....
I want to prevent the user to save (or ask if he really wants to
save).
The code works fine in Excel (VBAProject - ThisWorkbook), but not in
Word (Project - Microsoft Word Objects - ThisDocument) - see below...
How do I have to change the vba word code?
Thanks a lot,
Andreas
EXCEL: works!
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
a = MsgBox("Do you really want to save the workbook?", vbYesNo)
If a = vbNo Then Cancel = True
End Sub
WORD: doesn't work
Private Sub Document_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
a = MsgBox("Do you really want to save the workbook?", vbYesNo)
If a = vbNo Then Cancel = True
End Sub