Re: Pass MailMerge.CreateDataSource to document from Access

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Cindy,

Running a macro in my Word 2003 environment showed the script I will use.
However, it created a first line, which was

ActiveDocument.MailMerge.MainDocumentType = wdFormLetters

Do I need this prior to my "objWord.MailMerge.CreateDataSource, etc."?

Otherwise I will try this in a little while and let you know. Thank you.

"Cindy M -WordMVP-" wrote:

> Hi =?Utf-8?B?cmljaGFyZGI=?=,
>
> > I create a query in Access and then use "GetObject", etc. to Activate a Word
> > document and then runautomacro, which contains the code to run the document
> > with mailmerge back to my Access query as the data source. I could use some
> > help with a complete example of "objWord.MailMerge.CreateDataSource", where
> > the data source is my Access query.
> >
> > Another important question: In a multi-user environment, can more than one
> > Access user activate the same Word Document, pass a [unique] data source (a
> > query) and each one run their job at the same time?
> >
> A note on this point: the answer would be no. But you could (and should, even
> with the new scenario) set up a TEMPLATE. Your automation code then uses Set
> doc = wdobj.Documents.Add("TemplatePathAndName") to create the new merge
> document from the template.
>
> It's difficult to give you any specific help with the syntax for OpenDataSource
> because it can vary so widely depending on Word version, and which connection
> method is used. The best way to get a handle on this is to
>
> 1. Test the available connection methods for the Office version involved. (Tell
> me which you have, and I'll tell you how to do this)
>
> 2. Record making the connection in a macro in Word. You can this port this to
> your Access VBA code.
>
> 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 :-)
>
>
.



Relevant Pages

  • Re: Mail Merging a Selection from within an Excel Sheet
    ... however, at some point it truncates that connection string to 255 characters (it isn't immediately, at least not in Word 2003, but it may do so when it reopens the document ... with selection criteria of "not blank" joined by AND. ... macro, things are slightly different. ...
    (microsoft.public.word.mailmerge.fields)
  • Excel DB Queries: passwords and connections
    ... I am running Excel 2007 on a Vista computer. ... file has multiple macros that query different parts of the database. ... I have one macro in particular that is troublesome. ... is there a way to refresh the connection without ...
    (microsoft.public.excel.programming)
  • Excel DB Queries: passwords and connections
    ... I am running Excel 2007 on a Vista computer. ... file has multiple macros that query different parts of the database. ... I have one macro in particular that is troublesome. ... is there a way to refresh the connection without ...
    (microsoft.public.excel.programming)
  • Excel DB Queries: passwords and connections
    ... I am running Excel 2007 on a Vista computer. ... file has multiple macros that query different parts of the database. ... I have one macro in particular that is troublesome. ... is there a way to refresh the connection without ...
    (microsoft.public.excel.programming)
  • Re: Unwanted dialog when performing a mail merge
    ... the template and stops executing code; code in an AutoNew macro in the Word ... "ODSO expects an SQL query for the data source in the SQLStatement argument ... missing information" made me insert the Connection argument again, ...
    (microsoft.public.word.vba.general)