' The interfaces we need
Dim memo As WPDynamic.IWPMemo = Me.WpdllInt1.Memo
Dim cursor As WPDynamic.IWPTextCursor = memo.TextCursor
' Create the mailing template
memo.Clear(False, True)
memo.CurrAttr.Clear()
memo.CurrAttr.SetFontSize(10.0!)
cursor.InputField("NAME", "Name", False)
cursor.InputString(ChrW(13), 0)
cursor.InputField("ADR1", "Adr1", False)
cursor.InputString(ChrW(13), 0)
cursor.InputField("ADR2", "Adr2", False)
cursor.InputString(ChrW(13) & ChrW(13), 0)
memo.CurrAttr.IncludeStyles(1)
cursor.InputField("ZIP", "00000", False)
cursor.InputString(" ", 0)
cursor.InputField("CITY", "City", False)
' Simulate a mail merge - do a loop in this example
Dim i As Integer
For i = 1 To 30
memo.MergeText("")
memo.RTFDataAppendTo("LABELS", 1)
Next
' Select the resulting text
memo.RTFDataSelect("LABELS")
' Hide the field markers
memo.SpecialTextAttr( _
WPDynamic.SpecialTextSel.wpInsertpoints).Hidden = True
' Define the label properties
Dim label As WPDynamic.IWPLabelDef = memo.LabelDef
label.Caption = "WPCubed GmbH * St. Ingbert Str. 30 * 8151 Munich"
label.ColumnCount = 2
label.RowCount = 7
label.Horizontal = 0.5!
label.Vertical = 0.5!
' ... and activate it
label.Active = True