Share via


MailMergeDataSource Object [Publisher 2003 VBA Language Reference]

MailMerge
MailMergeDataSource
Multiple objects

Represents the data source in a mail merge or catalog merge operation.

Using the MailMergeDataSource Object

Use the DataSource property to return the MailMergeDataSource object. The following example displays the name of the data source associated with the active publication.

Sub ShowDataSourceName()
    If ActiveDocument.MailMerge.DataSource.Name <> "" Then _
        MsgBox ActiveDocument.MailMerge.DataSource.Name
End Sub

The following example tests the open data source associated with the active publication to determine whether the LastName field includes the name Fuller.

Sub FindSelectedRecord()
    With ActiveDocument.MailMerge
        If .DataSource.FindRecord(FindText:="Fuller", _
                Field:="LastName") = True Then
            MsgBox "Data was found"
        End If
    End With
End Sub

Properties | ActiveRecord Property | Application Property | ConnectString Property | DataFields Property | Filters Property | FirstRecord Property | Included Property | InvalidAddress Property | InvalidComments Property | LastRecord Property | MappedDataFields Property | Name Property | Parent Property | RecordCount Property | TableName Property | Type Property

Methods | ApplyFilter Method | Close Method | FindRecord Method | OpenRecipientsDialog Method | SetAllErrorFlags Method | SetAllIncludedFlags Method | SetSortOrder Method

Parent Objects | MailMerge Object

Child Objects | MailMergeDataFields Object | MailMergeFilters Object | MailMergeMappedDataFields Object