Hi =?Utf-8?B?TGlmZWxvbmcgTGVhcm5lcg==?=,
I want to start up a Word template from an excel spreadsheet and mailmerge
the template with data held in the spreadsheet. How do I do this? The
process has to be robust so I can distribute copies of the spreadsheet to all
staff in my organisation and have the mailmerge work for them. ie they
could have different versions of Excel/Word on their computers. I am using
Office 2000.
Difficult question to answer, posted as it is. Basically, you'd need VBA code in
Excel that
- starts a new document from your template. If you can't know where the user
will store the template, then you'd need to prompt the user for that path.
- links the document to the data source. I assume you can get the file path
to the workbook from the Excel environment...
- more tricky is setting up the actual connection, the workbook being open,
and thus possibly locking out a connection. You also have to consider what kind
of connection. Office 97/2000 support three different kinds for Excel; an
additional one comes into play in Office 2002-2003, and can interfere with the
macro code.
So, at this point, you have to do some testing, to see what connection types
Excel allows, and whether the data comes across the way you need it. You might
also consider exporting the data to a separate file (even a text or *.mdb file)
and connecting to that, in order to circumvent possible problems with file
locking.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail