ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with VBA Mail Merge (https://www.excelbanter.com/excel-programming/342442-re-help-vba-mail-merge.html)

Dave Peterson

Help with VBA Mail Merge
 
I bet you'd get more answers in an MSWord newsgroup.

Claude wrote:

Hi,
Could someone please tell me if it is possible to include a mail merge
field in the "Address:=" part of this code located at the bottom? I
guess what I'm trying to do is include my own text & mail merge field
in the label?
I was hoping the the following could somehow be inserted?

ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
"Distribution"

ActiveDocument.MailMerge.MainDocumentType = wdMailingLabels
ActiveDocument.MailMerge.OpenDataSource Name:= _
"S:\mag-hr\Payroll\Payroll@Magill\Reporting\Group Distribution
List Weekly.xls" _
, ConfirmConversions:=False, ReadOnly:=False,
LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="",
Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="Entire Spreadsheet",
SQLStatement _
:="", SQLStatement1:=""
Application.MailingLabel.DefaultPrintBarCode = False
Application.MailingLabel.CreateNewDocument Name:="L7163",
*Address:= _
"Weekly Payslips - Private & Confidential" & Chr(13) & Chr(13)
_
& Chr(13) & "Weekly Payslips - Private & Confidential" &
Chr(13), _* AutoText:="", LaserTray:=wdPrinterManualFeed

Not having much luck!
Thanks
Claude

--
Claude
------------------------------------------------------------------------
Claude's Profile: http://www.excelforum.com/member.php...o&userid=27992
View this thread: http://www.excelforum.com/showthread...hreadid=474979


--

Dave Peterson


All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com