Columns.RemoveAll Method (Outlook)
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Columns.RemoveAll Method (Outlook)

Removes all the columns from the Columns collection and resets the Table.

Version Added: Outlook 2007

expression .RemoveAll

expression A variable that represents a Columns object.

RemoveAll resets the Table by moving the current row to just before the first row of the Table. After a call to RemoveAll, Columns.Count becomes zero (0).

The following code sample illustrates how to obtain a Table object based on the LastModificationTime of items in the Inbox. It also shows how to remove the default columns of the Table, add specific columns, and print the values of the corresponding properties of these items.

Sub RemoveAllAndAddColumns() 
 Dim Filter As String 
 Dim oRow As Outlook.Row 
 Dim oTable As Outlook.Table 
 Dim oFolder As Outlook.Folder 
 'Get a Folder object for the Inbox 
 Set oFolder = Application.Session.GetDefaultFolder(olFolderInbox) 
 'Define Filter to obtain items last modified after May 1, 2005 
 Filter = "[LastModificationTime] > '5/1/2005'" 
 'Restrict with Filter 
 Set oTable = oFolder.GetTable(Filter) 
 'Remove all columns in the default column set 
 'Specify desired properties 
 With oTable.Columns 
 .Add ("Subject") 
 .Add ("LastModificationTime") 
 'PR_ATTR_HIDDEN referenced by the MAPI proptag namespace 
 .Add ("") 
 End With 
 'Enumerate the table using test for EndOfTable 
 Do Until (oTable.EndOfTable) 
 Set oRow = oTable.GetNextRow() 
 Debug.Print (oRow("Subject")) 
 Debug.Print (oRow("LastModificationTime")) 
 Debug.Print (oRow("")) 
End Sub
© 2016 Microsoft