on running mailmerge from access how to close word

A

alacosta

when running mail merge from access 2007 word opens completes mail merge ok
but how do i close word from within the VB script to return to access with a
docs not saved (Note 2 windows open in word ..the original doc ....and the
merged letters)
 
B

BeWyched

The following script will close all instances of Word (including hidden
instances):

On Error GoTo Word_Is_Closed
Word_Close:
Set oWord = GetObject(, "Word.Application")
oWord.Activate
oWord.Quit
Set oWord = Nothing
GoTo Word_Close
Word_Is_Closed:
Exit sub

The problem with this script is that it will close all instances which may
not be what you need. I have yet to find a way to be selective about what is
closed.

Cheers.

BW
 

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