This documentation is archived and is not being maintained.

ColumnFormat Object (Outlook)

Represents the display properties of an order field or view field in a view.

Version Added: Outlook 2007

The ColumnFormat object represents the display properties, such as the alignment or field type, of an OrderField or ViewField object. Use the ColumnFormat property of the ViewField object to access the display properties of a view field.

Use the Label property to obtain or change the text used to label the field, or the Align property to determine the alignment of the contents within the field.

Use the FieldType property to determine the type and form of the data displayed for that field, and the FieldFormat property to determine how to format the data for that field.

The following Visual Basic for Applications (VBA) example iterates through the ViewFields collection of the current TableView object, displaying the label and XML schema names of each ViewField object in the collection.

Private Sub DisplayTableViewFields() 
 Dim objTableView As TableView 
 Dim objViewField As ViewField 
 Dim strOutput As String 
 If Application.ActiveExplorer.CurrentView.ViewType = _ 
 olTableView Then 
 ' Obtain a TableView object reference for the 
 ' current table view. 
 Set objTableView = _ 
 ' Iterate through the ViewFields collection for 
 ' the table view, obtaining the label and the 
 ' XML schema name for each field included in 
 ' the view. 
 For Each objViewField In objTableView.ViewFields 
 With objViewField 
 strOutput = strOutput & .ColumnFormat.Label & _ 
 " (" & .ViewXMLSchemaName & ")" & vbCrLf 
 End With 
 ' Display a dialog box containing the concatenated 
 ' view field information. 
 MsgBox strOutput 
 End If 
End Sub