Word 2003/2007 Prompting to Save Document

  • Thread starter Database Whiz Consulting
  • Start date
D

Database Whiz Consulting

Hello All. I posted this question last week. Got some suggestions from Doug
the MVP (Gracias for you efforts), but was unable to solve the problem. No
one else chimed in. Here's the deal.

We have an application that creates 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 if the file is created with Word
2000 or Word XP, nor does it occur with documents not created in this manner.

Behavior continues with file indefinitely, where it will always prompt the
user to save the document upon close if the user prints the document. I've
posted an example of the document on our website:

http://www.databasewhiz.com/tmp/NAS/8000009_Demand Letter.doc

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
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

Nightmare prompt is starting to cost us lots of time & money. If anybody has
a clue as to why this would occur and how to fix it, would really really
appreciate it.

Thanks In Advance,


RJ
Database Whiz Consulting
 
M

macropod

It's probably due to the fact you've got a TIME field (formatted to give a date output) in the letter. This will update whenever you
print the document and, so, Word will alert you to the fact that something has changed. If the document is created from a template,
you'd be better off changing the TIME field to a CREATEDATE field or inserting the date programmatically when the document is first
saved. That way, the date will remain fixed - which is probably what you need to happen anyway.
 
D

Database Whiz Consulting

Outstanding! This is indeed the issue and you are also correct in the fact
that I do need to swap out the time field for one that is permanent. Wasn't
an issue in this app cuz the files only stay on the hard drive for a short
period of time, but was something I needed to update in a similar
application. I thank you emmensely for your insight into my problem.

RJ
Database Whiz Consulting

macropod said:
It's probably due to the fact you've got a TIME field (formatted to give a date output) in the letter. This will update whenever you
print the document and, so, Word will alert you to the fact that something has changed. If the document is created from a template,
you'd be better off changing the TIME field to a CREATEDATE field or inserting the date programmatically when the document is first
saved. That way, the date will remain fixed - which is probably what you need to happen anyway.

--
Cheers
macropod
[MVP - Microsoft Word]


Database Whiz Consulting said:
Hello All. I posted this question last week. Got some suggestions from Doug
the MVP (Gracias for you efforts), but was unable to solve the problem. No
one else chimed in. Here's the deal.

We have an application that creates 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 if the file is created with Word
2000 or Word XP, nor does it occur with documents not created in this manner.

Behavior continues with file indefinitely, where it will always prompt the
user to save the document upon close if the user prints the document. I've
posted an example of the document on our website:

http://www.databasewhiz.com/tmp/NAS/8000009_Demand Letter.doc

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
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

Nightmare prompt is starting to cost us lots of time & money. If anybody has
a clue as to why this would occur and how to fix it, would really really
appreciate it.

Thanks In Advance,


RJ
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