Class ColumnFormat (Outlook VBA)
The class ColumnFormat represents the display properties of an order field or view field in a view. To use a ColumnFormat class variable it first needs to be instantiated, for example
Dim cft as ColumnFormat
Set cft = Session.CreateSharingItem.Move.Views(1).ViewFields(1).ColumnFormat
Align
Returns or sets an OlAlign constant that indicates the alignment of the column label for the property to which the ColumnFormat object is associated. Possible return values are olAlignCenter - Indicates that the label for the specified column should be centered, olAlignLeft - Indicates that the label for the specified column should be left-aligned, olAlignRight - Indicates that the label for the specified column should be right-aligned.
The value of this property is ignored for properties in which the column label is displayed as an icon.
Session.CreateSharingItem.Move.Views(1).ViewFields(1).ColumnFormat.Align = olAlignCenter
Class
Returns an OlObjectClass constant indicating the object's class. Here you can find possible values for
Dim oocsClass As OlObjectClass
oocsClass = Session.CreateSharingItem.Move.Views(1).ViewFields(1).ColumnFormat.Class
FieldFormat
Returns or sets a Long value that represents the display format of the property to which the ColumnFormat object is associated.
The value of this property is a constant from an enumeration, where the enumeration is dependent on the value of the FieldType property for the ColumnFormat object:
Session.CreateSharingItem.Move.Views(1).ViewFields(1).ColumnFormat.FieldFormat =
FieldType
Returns an OlUserPropertyType constant which represents the field type of the property to which the ColumnFormat object is associated. Here you can find possible values for
Dim oupFieldType As OlUserPropertyType
oupFieldType = Session.CreateSharingItem.Move.Views(1).ViewFields(1).ColumnFormat.FieldType
Label
Returns or sets a String value that represents the column label and tooltip displayed for the property to which the ColumnFormat object is associated.
For built-in Outlook properties, the default value for this property is the localized name of the property. For custom Outlook properties, the default value for this property is the name of the property. The value of this property applies only to the tooltip for Outlook properties in which the column header is represented as an icon.
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 = _
Application.ActiveExplorer.CurrentView
' 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
Next
' Display a dialog box containing the concatenated
' view field information.
MsgBox strOutput
End If
End Sub
Session
Returns the NameSpace object for the current session.
The Session property and the GetNamespace method can be used interchangeably to obtain the NameSpace object for the current session. Both members serve the same purpose. For example, the following statements perform the same function:
Width
Returns or sets a Long value indicating the approximate width (in characters) of the column.
This property can be set to a value between 2 and 1024. If this property is set to a value less than 2, the property is set to 2. If this property is set to a value greater than 1024, the property is set to 1024. If the value of this property for every column in a view is less than the total width of the view, then the Width property of the ColumnFormat object for the last ViewField in the view is increased to match the total width of the view.
Session.CreateSharingItem.Move.Views(1).ViewFields(1).ColumnFormat.Width =