Word 2003/2007 Prompting To Save Document

  • Thread starter Database Whiz Consulting
  • Start date
D

Database Whiz Consulting

We have an application that creates protected Word documents by automating
Word with VBA and mail merge. All is good, application works as it should,
creates the documents just fine and all. Problem is, when the user opens the
file with Word 2003 or 2007 and prints the document (they are protected, so
they can't change them), the document still prompts the user if they want to
save the document. Behaviour does not occur with Word 2000, nor does it occur
with documents not created in this manner. Clearly Word thinks something is
changing when the user prints the file, but what? I've included part of the
Sub that generates the file:

Set wrdApp = CreateObject("Word.Application")
wrdApp.Documents.Open FileName:=strDoc, AddToRecentFiles:=False,
Visible:=True
wrdApp.Documents.Item(1).Activate
With wrdApp.Documents(strDoc).MailMerge
.DataSource.FirstRecord = 1
.DataSource.LastRecord = 1
.Destination = wdSendToNewDocument
.Execute
End With
wrdApp.Documents.Item(1).Activate

wrdApp.Documents.Item(1).Protect wdAllowOnlyComments
wrdApp.Documents.Item(1).SaveAs "C:\access\NAS\" & intHmnrID & "_" &
strDocName
wrdApp.Documents.Item(1).Close
wrdApp.Documents(strDoc).Close SaveChanges:=wdDoNotSaveChanges
wrdApp.Quit
Set wrdApp = Nothing
 
D

Doug Robbins - Word MVP

Does the user have the checkboxes for "Update automatic links at Open"
and/or "Update fields" and "Update links" checked on the General and Print
tabs of the Options dialog (accessed by selecting Options from the Tools
menu in Word 2003) and under the Advanced and Display sections of the Word
Options dialog in 2007?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Database Whiz Consulting" <Database Whiz
(e-mail address removed)> wrote in message
news:[email protected]...
 
D

Database Whiz Consulting

The Update Links and Update Fields boxes were not checked. Update automatic
links at Open was checked so I unchecked it. It did not affect behavior.

I really appreciate the response. Got any other clues?

TIA

Ray Jefferson
Database Whiz Consulting
 
D

Doug Robbins - Word MVP

If the document was printed to a printer/printer driver combination that
differed from that which was active on the computer on which the document
was created, the document may have been repaginated which would be enough to
trigger the Save prompt.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Database Whiz Consulting"
 
D

Database Whiz Consulting

Thanks Doug, but yeah, that's not it either. At first I thought you might be
on to something cuz I thought it might be because the Mail Merge doc was
created with one machine and its printer, while the actual mail merged
document would be created on the client. However, I did a couple of things to
disprove this. 1) I opened and resaved the Mail Merge doc and then ran the
client app all from the same machine. Same behavior. 2) I simply opened the
merged doc, printed it, and when I got the prompt, I chose YES and saved the
document. I then reopened the doc and printed it again. It still prompts me
to save the document.

It also appears that I misspoke earlier. The behavior does occur with Word
2000. Not sure why I thought it didn't.

I also just tried this. I commented out the line that protects the document.
I created a file, opened it, modified it, and saved it. Then I printed it.
Sure enough, it prompted me to save the document anyway. In all scenarios,
we'll only get the prompt if we print the document. Simply opening the doc
will not cause the prompt when you close the document.

I won't keep bugging you, but if you come up with anything else for me to
try, please let me know.

Thanks Doug,


Ray Jefferson
Database Whiz Consulting
 
D

Doug Robbins - Word MVP

Looking back over your code, I would guess that it is happening because the
document has not been printed before it is saved by the code.

You might try incorporating

wrdApp.Documents.Item(1).Repaginate

into your code immediately before the document is saved.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Database Whiz Consulting"
 

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