var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Help with Mail Merge
I've set up a script behind a command button to generate a mailmerged document, which retrieves some information from a table. This is working fine.
But how would I go about adding additional sections onto the mail merge using an input control on the form?
This is the code I'm using for the Mail Merge:
Dim objWordApp As Word.Application
Dim objWord As Word.Document
Dim oSel As Word.Selection
Set objWordApp = CreateObject("Word.Application")
Set objWord = objWordApp.Documents.Add
'Make Word visible.
objWord.Application.Visible = True
Name:="O:\MIS\Employer Engagement\RECEPE_Client.mde", _
Connection:="TABLE dbo_tblEmployer", _
SQLStatement:="Select * from [dbo_tblEmployer]"
Set oSel = objWord.Application.Selection
.Add oSel.Range, "Emp_Name"
.Add oSel.Range, "Addr1"
.Add oSel.Range, "Addr2"
.Add oSel.Range, "Addr3"
.Add oSel.Range, "Addr4"
.Add oSel.Range, "Addr5"
.Add oSel.Range, "Country"
.Add oSel.Range, "PostCode"
.Add oSel.Range, "PostCode2"
.Add oSel.Range, "Tel_No"
'Execute the mail merge
Set oSel = Nothing
Set objWord = Nothing
Set objWordApp = Nothing
I set up the document in word by adding the fields manually. For the users that cannot handle/won't set up Word to do a mail merge, I have created a report in Access that has a large memo field where the user gets to edit the text of the message. Everything else is done by my access program. I have never used TypeParagraph and have never needed to. If it is not working the way you expect, perhaps you could use one of my solutions.