PC Review


Reply
Thread Tools Rate Thread

How to Automate Word mail merge from AC2007?

 
 
deko
Guest
Posts: n/a
 
      27th Feb 2010
I'm trying to do a Word mail merge from Access 2007 -- populating a
Word 2007 template with data from recordsets built off queries.

The problem I'm having is the current code creates each letter as a
separate Word doc. I need one big Word doc with page breaks between
each letter.

The code uses nested loops - the first recordset rst has the list of
people, the second rstBkm has bookmark data.

Question: How to get this code to create one Word doc with page breaks
between letters rather than each letter in a separate Word Doc?
Thanks in advance.

[abbreviated code below]

Set wordApp = New Word.Application

Do While Not rst.EOF 'recordset of individuals from Access

Set wordDoc = wordApp.Documents.Add(Template:=strTemplate,
NewTemplate:=False, DocumentType:=0)

rstBkm.MoveFirst

Do While Not rstBkm.EOF 'bookmarks to be populated
strBkm = rstBkm!FieldName
If (wordDoc.Bookmarks.Exists(strBkm)) Then
If strBkm = "Transactions" Then Call
GetTransactions(wordApp, wordDoc)
wordDoc.Bookmarks(strBkm).Select
wordApp.Selection.TypeText Text:=GetText(strBkm,
lngRid, lngEid)
End If
rstBkm.MoveNext
Loop

wordDoc.PrintOut

Loop
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate Mail merge =?Utf-8?B?UGl0dQ==?= Microsoft Access 2 20th Mar 2006 05:38 PM
Automate Word 2002 mail merge from Access 2002 =?Utf-8?B?RWQgQg==?= Microsoft Access External Data 2 27th Jun 2005 03:45 PM
Automate Mail Merge Hank Stalica Microsoft Access 1 19th Jan 2005 07:25 AM
Any ASP.NET Example? Automate Word to Perform a Client-Side Mail Merge Martin Feuersteiner Microsoft ASP .NET 0 19th Jul 2004 04:07 AM
Automate Word Mail Merge with Access Data Lotus Microsoft Access VBA Modules 1 21st Jan 2004 01:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:23 AM.