2nd Word doc appears after Word template - only in Vista

M

Mojo

Hi All

Apologies for the bizarre sounding subject text, but just wanted to put the
key factors in.

Basically I have a VB6 app that populates pre-created Word template docs and
everything is rosy on WinXP (all versions), but the same code on Vista does
the following:

1) Copy of Word template is populated and is displayed for user to look at
and if required they can save it to a diff filename. Thus the template is
never overwritten.

2) If the user doesn't want to save the doc and simply clicks the close box
then the usual 'Are you sure do you want to save' message box appears.

3) HOWEVER, upon closing this copy, a 2nd message box appears saying do you
want to save changes to the original template!!! Luckily the user has been
clicking No, but why is it doing this?

An example of one of my VB to Word 2000/2003 routines is as follows:

Set oWord = CreateObject("Word.Application")
Set oNewDoc = oWord.Documents.Add(App.Path & "\data\progress-inits.dot")

' = = = = = = = = = = = = = data goes in here

oWord.Visible = True
oWord.Activate

Set oDoc = Nothing
Set oNewDoc = Nothing
Set oWord = Nothing

Straightforward stuff don't you think?

Like I said, the routines work perfectly well in XP, but in Vista they
generate this anomaly.

Has anybody had this before? Is there a workaround?

Many thanks
 
M

Mojo

Hi Nobody

Thanks for your response, but what will that do for me???

See the Saved Property. It's read/write.
 
N

Nobody

Mojo said:
Hi Nobody

Thanks for your response, but what will that do for me???

You can mark the template as saved, so the user is not prompted to save it.
From MSDN Library - October 2001:

Example

This example saves the active document if it contains previously unsaved
changes.

If ActiveDocument.Saved = False Then ActiveDocument.Save

This example changes the status of the Normal template to unchanged. If
changes were made to the Normal template, the changes aren't saved when you
quit Word.

NormalTemplate.Saved = True
Application.Quit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top