Re: getting word to prompt to save on Close
- From: "Shauna Kelly" <ShaunaKelly@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 11 Jun 2005 13:02:43 +1000
Hi Hal
I think the problem here is that the Word document isn't "dirty": there are
no changes to be saved, so the user isn't prompted to save any.
For testing, use oWordDoc.Saved = False before the oWordDoc.Close line. This
"dirties" the document. Word then thinks there are changes to be made, and
the prompt to save works as intended.
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
"Hal Tz" <HalTz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F9C7741C-6232-497C-968F-607A30316DCD@xxxxxxxxxxxxxxxx
> Look like I have the opposite problem of a lot of threads here. I'm a
> total
> newbie to Word Automation, am doing Document.Close, and have tried
> oWordDoc.Close SaveChanges:=wdPromptToSaveChanges,
> OriginalFormat:=wdPromptUser
> and many variation on it, it always closes the doc saving any changes
> without ptompting. Here's the code snippet. Any ideas? Thanks.
>
> Dim oWD As Word.Application
> Dim oWordDoc As Word.Document
> Set oWD = New Word.Application
> Set oWordDoc = oWD.Documents.Open("c:\z.doc")
> oWD.Visible = True
> oWD.Activate
> MsgBox ("hit OK to close")
> oWordDoc.Close SaveChanges:=wdPromptToSaveChanges ,
> OriginalFormat:=wdPromptUser
> --
> Hal
.
- References:
- getting word to prompt to save on Close
- From: Hal Tz
- getting word to prompt to save on Close
- Prev by Date: Re: word - vba - template and table
- Next by Date: Re: if statement in word macro
- Previous by thread: getting word to prompt to save on Close
- Index(es):
Relevant Pages
|