Connecting Tech Pros Worldwide Forums | Help | Site Map

More of a Word problem really.. mailmerge

Not Me
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi,

I have a document in MS Word, with the mailmerge all set up.. when I
open the document it asks me if I would like to run the query, I must
click yes/ok to apply the mail merge.

I'm trying to open this file from MS-Access using VBA, I can open the
file fine, but I am not presented with the question of running the
query, and it doesn't run it automatically.

(How) can I amend the open command or subsequently allow the query to
run with minimal intervention from the user?

Help is much appreciated,
Chris

Andy Davis
Guest
 
Posts: n/a
#2: Nov 13 '05

re: More of a Word problem really.. mailmerge


Assuming you have the following in your code:
objWord.MailMerge.OpenDataSource Name:="C:\database.mdb",
LinkToSource:=True, Connection:="TABLE sourcetable", SQLStatement:="SELECT *
FROM [sourcetable]"

Then add this line of code to execute the mail merge process:

objWord.MailMerge.Execute


"Not Me" <not.me@zxy.blah.com> wrote in message
news:d98pca$1pa$1@ucsnew1.ncl.ac.uk...[color=blue]
> Hi,
>
> I have a document in MS Word, with the mailmerge all set up.. when I open
> the document it asks me if I would like to run the query, I must click
> yes/ok to apply the mail merge.
>
> I'm trying to open this file from MS-Access using VBA, I can open the file
> fine, but I am not presented with the question of running the query, and
> it doesn't run it automatically.
>
> (How) can I amend the open command or subsequently allow the query to run
> with minimal intervention from the user?
>
> Help is much appreciated,
> Chris[/color]


Not Me
Guest
 
Posts: n/a
#3: Nov 13 '05

re: More of a Word problem really.. mailmerge


Andy Davis wrote:[color=blue]
> Assuming you have the following in your code:
> objWord.MailMerge.OpenDataSource Name:="C:\database.mdb",
> LinkToSource:=True, Connection:="TABLE sourcetable", SQLStatement:="SELECT *
> FROM [sourcetable]"
>
> Then add this line of code to execute the mail merge process:
>
> objWord.MailMerge.Execute[/color]

Hey,

Thanks for that. What I'm trying to achieve is simply the same result
as if I just double clicked the file to open it, however it looks like
I'm going to have to strip the mail merge data from the word document,
then inject it via VBA using your methods!

Ah well, cheers for the help
Chris

Closed Thread