Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2007

Tip: Looking for answers? Try searching our database.

SaveAsUI doesn'T work in MS Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
online.experiment@googlemail.com - 07 Nov 2007 09:54 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.