Skip to content

Latest commit

 

History

History
110 lines (54 loc) · 2.24 KB

Outlook.Columns.RemoveAll.md

File metadata and controls

110 lines (54 loc) · 2.24 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Columns.RemoveAll method (Outlook)
vbaol11.chm2743
vbaol11.chm2743
Outlook.Columns.RemoveAll
e9923548-9c75-e5dd-0643-3c42cd112352
06/08/2017
medium

Columns.RemoveAll method (Outlook)

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

Syntax

expression. RemoveAll

expression A variable that represents a Columns object.

Remarks

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).

Example

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() 
 
 'Declarations 
 
 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 
 
 oTable.Columns.RemoveAll 
 
 'Specify desired properties 
 
 With oTable.Columns 
 
 .Add ("Subject") 
 
 .Add ("LastModificationTime") 
 
 'PR_ATTR_HIDDEN referenced by the MAPI proptag namespace 
 
 .Add ("http://schemas.microsoft.com/mapi/proptag/0x10F4000B") 
 
 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("http://schemas.microsoft.com/mapi/proptag/0x10F4000B")) 
 
 Loop 
 
End Sub

See also

Columns Object

[!includeSupport and feedback]