Share via


Column Property [Publisher 2003 VBA Language Reference]

Column property as it applies to the Cell and CellRange objects.

Returns a Long that represents the table column containing the specified cell. Read-only.

expression.Column

expression Required. An expression that returns one of the above objects.

Column property as it applies to the MailMergeFilterCriterion object.

Returns a String that represents the name of the field in the mail merge data source to use in the filter. Read/write.

expression.Column

expression Required. An expression that returns one of the above objects.

Example

Example as it applies to the Cell and CellRange objects.

This example adds a page to the active publication, creates a table on that new page, and diagonally splits all cells in even-numbered columns.

Sub CreateNewTable()

    Dim pgeNew As Page
    Dim shpTable As Shape
    Dim tblNew As Table
    Dim celTable As Cell
    Dim rowTable As Row

    'Creates a new document with a five-row by five-column table
    Set pgeNew = ActiveDocument.Pages.Add(Count:=1, After:=1)
    Set shpTable = pgeNew.Shapes.AddTable(NumRows:=5, NumColumns:=5, _
        Left:=72, Top:=72, Width:=468, Height:=100)
    Set tblNew = shpTable.Table

    'Inserts a diagonal split into all cells in even-numbered columns
    For Each rowTable In tblNew.Rows
        For Each celTable In rowTable.Cells
            If celTable.Column Mod 2 = 0 Then
                celTable.Diagonal = pbTableCellDiagonalUp
            End If
        Next celTable
    Next rowTable

End Sub

Example as it applies to the MailMergeFilterCriterion object.

The following example changes an existing filter to remove from the mail merge all records that do not have a Region field equal to "WA".

Sub SetQueryCriterion()
    Dim intItem As Integer
    With ActiveDocument.MailMerge.DataSource.Filters
        For intItem = 1 To .Count
            With .Item(intItem)
                If .Column = "Region" Then
                    .Comparison = msoFilterComparisonNotEqual
                    .CompareTo = "WA"
                    If .Conjunction = "Or" Then .Conjunction = "And"
                End If
            End With
        Next intItem
    End With
End Sub

Applies to | Cell Object | CellRange Collection | MailMergeFilterCriterion Object