473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

More of a Word problem really.. mailmerge

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
Nov 13 '05 #1
2 1435
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" <no****@zxy.blah.com> wrote in message
news:d9**********@ucsnew1.ncl.ac.uk...
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

Nov 13 '05 #2
Andy Davis wrote:
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


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

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dan Nash | last post by:
Hi guys I wonder if you could help. I'm trying to create a bespoke interface for mail merging from an Access database in Word. At the moment, I'm just trying it with CSV files, and it works....
5
by: Picho | last post by:
Hi all, I have a problem automating word (office xp). I am trying to create a mailmerge datasource using this code: object oFieldsVector = (object)fieldsVector; object oFileName =...
0
by: dixie | last post by:
I have an application which does a lot of reports (letters) by automation with Word. The mail merge main document is a Word template and I transfer a text file out to a prenamed filename to act as...
4
by: pmhaupt2 | last post by:
I developed an Access 2003 program that will allow the user to produce a group of Word letters that merge with data records from an Access database. I created a mail merge Word document and...
10
by: John | last post by:
Hi I am trying to do a word mailmerge form within my vb.net app. My problem is how to do a query on one of my tables and use the result as the mail merge datasource. Any help would be...
2
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
0
by: bobh | last post by:
Hi All, I'm trying to get this(see below) to work but have not been successful so far, what I'm trying to get done is; open a word document which is already setup as a mailmerge document merge...
0
by: YY | last post by:
For some reason my word mail merge throws execption when it reaches wrdMailMerge = oDataDoc.MailMerge. Can any body guide me in a clean wasy of doing mailerge from sql server 2005 table ? I...
3
by: brat33 | last post by:
I am trying to use a command button to automate a process for creating mailing labels from a query in Access 2007, going into word 2007. Current code looks like the following: 'Start MS Word Dim...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.