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
online.experiment@googlemail.com - 07 Nov 2007 12:48 GMT
Hi found the solution!!!
Just added a module which is executed in the beginning.
Dim X As New EventClassModule
Sub AutoExec()
Set X.appWord = Word.Application
End Sub
Thanks Andreas
On 7 Nov., 10:54, online.experim...@googlemail.com wrote:
> Dear Group,
>
[quoted text clipped - 30 lines]
>
> End Sub