Second mail merge doesn't save

J

Jen

Hello. I have a mail merge set up from Access 97 to Word
97, and once the merge is completed the Word document gets
saved with a name that corresponds to the date and time it
was created. The problem is that if a second mail merge
document is requested, and the first merged document is
still open, the second merge will complete but the second
document will not be named with the date and time.
Instead, the first document that is still opened gets
renamed with the new date and time.

I'm not familiar enough with Word to know what I could do
to correct this. I'm using WordApp.ActiveDocument.SaveAs
FileName:="Path:\Name", to save the file. I don't
understand why the most recent mail merge requested
wouldn't be the active document?

Thanks,
Jen
 
C

Cindy Meister -WordMVP-

Hi Jen,
The problem is that if a second mail merge
document is requested, and the first merged document is
still open, the second merge will complete but the second
document will not be named with the date and time.
Instead, the first document that is still opened gets
renamed with the new date and time.

I'm not familiar enough with Word to know what I could do
to correct this. I'm using WordApp.ActiveDocument.SaveAs
FileName:="Path:\Name", to save the file. I don't
understand why the most recent mail merge requested
wouldn't be the active document?
Well, there's just no knowing, when something like
"ActiveDocument" is involved. I'd say your code is going to
need to do some checking - maybe against the document
FullName (an unsaved document won't have a path or a *.doc
extension) to make sure you have the right document.

If ActiveDocument.FullName ends in *.doc or contains "\",
then you don't have the right document. You can then do a
For Each doc in wdApp.Documents to test all the open
documents until you find one that's not yet saved, and also
contains Letters (or whatever merge type you're doing) in
its name.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan
24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

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