Group:  Microsoft Word ยป microsoft.public.word.vba.beginners
Thread: Closing Word without the prompt to save changes

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Closing Word without the prompt to save changes
mleviton[ at ]juno.com 03.08.2006 19:41:04
I am using an Access db to populate a word document, print it, and
close it. When it runs, the user should not be promted to save changes
when the document closes. The code includes
objWord.Documents("timesheet.doc").Close SaveChanges = False and
works on the win2000 server but the win2003 server prompts the user to
save changes. The following line works on our 2000 server (Office 10),
works on XP pro (Office 11) but not on 2003 server (Office 11).

objWord.Documents("timesheet.doc").Close SaveChanges =
False

We have also tried the following on our 2003 server without any luck:

Application.Quit(Word.WdSaveOptions.wdDoNotSaveChanges)

Private Sub Document_Close()
Me.Saved = True
End Sub

Application.DisplayAlerts = wdAlertsNone

objWord.Documents.Active.Close wdDoNotSaveChanges

All of these still prompt to save changes.
Thanks in advance for the help - PPT

Re: Closing Word without the prompt to save changes
"Dave Lett" <davelett[ at ]NOaolSPAM.com> 03.08.2006 20:02:50
You can try

Application.DisplayAlerts = wdAlertsNone

before the close event.
After the close event, you can reset the .DisplayAlerts property again.

HTH,
Dave


<mleviton[ at ]juno.com> wrote in message
news:1154634064.136466.209390[ at ]s13g2000cwa.googlegroups.com...
[Quoted Text]
>I am using an Access db to populate a word document, print it, and
> close it. When it runs, the user should not be promted to save changes
> when the document closes. The code includes
> objWord.Documents("timesheet.doc").Close SaveChanges = False and
> works on the win2000 server but the win2003 server prompts the user to
> save changes. The following line works on our 2000 server (Office 10),
> works on XP pro (Office 11) but not on 2003 server (Office 11).
>
> objWord.Documents("timesheet.doc").Close SaveChanges =
> False
>
> We have also tried the following on our 2003 server without any luck:
>
> Application.Quit(Word.WdSaveOptions.wdDoNotSaveChanges)
>
> Private Sub Document_Close()
> Me.Saved = True
> End Sub
>
> Application.DisplayAlerts = wdAlertsNone
>
> objWord.Documents.Active.Close wdDoNotSaveChanges
>
> All of these still prompt to save changes.
> Thanks in advance for the help - PPT
>


Re: Closing Word without the prompt to save changes
mleviton[ at ]juno.com 08.08.2006 13:40:57
Thanks Dave, but I still get prompted to save changes when I use
Application.DisplayAlerts = wdAlertsNone
Could there be something else overriding this code?

-PaPaTwin

Dave Lett wrote:
[Quoted Text]
> You can try
>
> Application.DisplayAlerts = wdAlertsNone
>
> before the close event.
> After the close event, you can reset the .DisplayAlerts property again.
>
> HTH,
> Dave
>

Re: Closing Word without the prompt to save changes
"Dave Lett" <davelett[ at ]NOaolSPAM.com> 08.08.2006 18:45:05
Hi,
You can also try using

ActiveDocument.Saved = True

HTH,
Dave

<mleviton[ at ]juno.com> wrote in message
news:1155044456.618568.152970[ at ]n13g2000cwa.googlegroups.com...
[Quoted Text]
> Thanks Dave, but I still get prompted to save changes when I use
> Application.DisplayAlerts = wdAlertsNone
> Could there be something else overriding this code?
>
> -PaPaTwin
>
> Dave Lett wrote:
>> You can try
>>
>> Application.DisplayAlerts = wdAlertsNone
>>
>> before the close event.
>> After the close event, you can reset the .DisplayAlerts property again.
>>
>> HTH,
>> Dave
>>
>


Re: Closing Word without the prompt to save changes
mleviton[ at ]juno.com 09.08.2006 16:23:00
Awesome! That line worked. Thanks Dave.

Dave Lett wrote:
[Quoted Text]
> Hi,
> You can also try using
>
> ActiveDocument.Saved = True
>
> HTH,
> Dave
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net