This documentation is archived and is not being maintained.

MailMergeDataSource.TableName Property

Office 2007
Returns a String that represents the name of the table within the data source file that contains the mail merge records. The returned value may be blank if the table name is unknown or not applicable to the current data source. Read-only.



expression   A variable that represents a MailMergeDataSource object.

Return Value


This example displays a message with the name of the mail merge data source table name.

Visual Basic for Applications
Sub EmployeeTable()
    With ActiveDocument.MailMerge.DataSource
        Select Case .TableName
            Case "Employees"
                MsgBox "This is an Employee mail merge publication."
            Case "Customers"
                MsgBox "This is a Customers mail merge publication."
            Case "Suppliers"
                MsgBox "This is a Suppliers mail merge publication."
            Case "Shippers"
                MsgBox "This is a Shippers mail merge publication."
            Case Else
                MsgBox "This is a " & .TableName & " mail merge publication."
        End Select
    End With
End Sub