[AccessD] Mailmerge Using Word & SQL Server (VB6)

William Hindman wdhindman at bellsouth.net
Wed Dec 17 08:19:59 CST 2003


http://support.microsoft.com/default.aspx?scid=kb;en-us;295264&Product=wrd
...maybe this will help someone :))
...by the way JIM, did you load all of the ODBC drivers when you installed
Word?

William Hindman
There are no easy answers, but there are simple answers. We must have
 the courage to do what we know is morally right." --Ronald Reagan


----- Original Message ----- 
From: "Jim DeMarco" <Jdemarco at hshhp.org>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Wednesday, December 17, 2003 8:20 AM
Subject: RE: Re: [AccessD] Mailmerge Using Word & SQL Server (VB6)


> Paul,
>
> Please let us know if this works for you.  I'm not sure it will though.
We are looking at using SQL data for a mail merge as well and my first take
is you cannot through the Word UI (SQL is not listed as a data source in the
"Get Data" process).  I don't know that you'll have any better luck
programmatically.  Looking at William's code it seems that a file name is in
order which you're not going to have in a SQL data source (but maybe a DSN
will work?).
>
> We've decided to insert bookmarks in a template documeht in place of mail
merge field placeholders.  Then we'll loop through the SQL table filling the
bookmarks with data from the recordset.  Then we are either going to
copy/paste into the end of a new master doc or we'll save the new file as
tmp.doc and do an "Insert File" command at the end of our master document
(simulating the mail merge).
>
> This project just came up yesterday so I don't have anything more definite
but this is our thought process right now.
>
> HTH,
>
> Jim DeMarco
> Director Product Development
> Hudson Health Plan
>
> -----Original Message-----
> From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net]
> Sent: Wednesday, December 17, 2003 4:25 AM
> To: Access Developers discussion and problem solving
> Subject: Re: Re: [AccessD] Mailmerge Using Word & SQL Server (VB6)
>
>
> Thanks, that should get me started......
>
> Paul Hartland
>
>
>
>
>
> Message date : Dec 17 2003, 09:19 AM
> >From : William Hindman
> To : Access Developers discussion and problem solving
> Copy to :
> Subject : Re: [AccessD] Mailmerge Using Word & SQL Server (VB6)
> ...don't have any merge code to SS7 Paul but the data connection syntax
> should be the same ...here's how I do it from an Access FE local table
> ...HTH :)
>
> Function ShowDirectory()
> Dim objWord As Word.Document
> Set objWord = GetObject("C:\Program
> Files\EMSReports\Documents\ShowDirectory.doc", "Word.Document")
> ' Make Word visible.
> objWord.Application.Visible = True
> ' Set the mail merge data source as the EMSReports database.
> objWord.MailMerge.OpenDataSource _
> Name:="C:\Program Files\EMSReports\emsreports.mdb", _
> LinkToSource:=True, _
> Connection:="TABLE tblShowDir", _
> SQLStatement:="Select * from [tblShowDir]"
> ' Execute the mail merge.
> objWord.MailMerge.Execute
> End Function
>
> William Hindman
> There are no easy answers, but there are simple answers. We must have
> the courage to do what we know is morally right." --Ronald Reagan
>
>
> ----- Original Message ----- 
> From:
> To: "accessd"
> Cc: "dba-vb"
> Sent: Wednesday, December 17, 2003 4:01 AM
> Subject: [AccessD] Mailmerge Using Word & SQL Server (VB6)
>
>
> To all,
>
> I am starting to write a mailmerge application for our own internal use, I
> want the user to be able to select the people they want to mail to and
store
> these in a temporary merge table on SQL Server 7.0 (this I have already
> done). I also give them the option to select an exisiting Word document or
> create a new one (also done)..
>
> I need to know how (when the user opens the Word document), I can tell the
> document to look at my temporary merge table on SQL Server 7.0.
>
> Anyone know how I can do this as I have never tried to connect a Word
> document to a datasource via code before.
>
> Thanks in advance for any help.
>
> Paul Hartland
> Freeserve AnyTime - HALF PRICE for the first 3 months - Save £7.50 a month
> www.freeserve.com/anytime
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> Freeserve AnyTime - HALF PRICE for the first 3 months - Save £7.50 a month
> www.freeserve.com/anytime
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
>
****************************************************************************
*******
> "This electronic message is intended to be for the use only of the named
recipient, and may contain information from Hudson Health Plan (HHP) that is
confidential or privileged.  If you are not the intended recipient, you are
hereby notified that any disclosure, copying, distribution or use of the
contents of this message is strictly prohibited.  If you have received this
message in error or are not the named recipient, please notify us
immediately, either by contacting the sender at the electronic mail address
noted above or calling HHP at (914) 631-1611. If you are not the intended
recipient, please do not forward this email to anyone, and delete and
destroy all copies of this message.  Thank You".
>
****************************************************************************
*******
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>




More information about the AccessD mailing list