Microsoft KB Archive/294556

= OL2002: Selection Collection Empty If Grouped Items Selected =

Article ID: 294556

Article Last Modified on 3/1/2004

-

APPLIES TO


 * Microsoft Outlook 2002 Standard Edition

-



This article was previously published under Q294556





SYMPTOMS
When you implement the Selection collection in a custom Outlook solution, the collection does not contain grouped items if the user clicks the group header in an Outlook view.



CAUSE
This is a limitation of the Outlook object model.



MORE INFORMATION
If you group items in a view, you can then click the group header. Although the items are not visibly selected in the view, you can then perform operations that affect all of the items in the group. For example, if you press DELETE, all of the items in the group are deleted.

In the Outlook object model, the Selection collection contains the items in a folder that are currently selected. However, the collection does not contain items if their corresponding group header has been selected.

Steps to Reproduce the Problem
 Create a view that groups items based on a particular field. To do this, make sure that you are using a table-based view, click Group By Box on the Advanced toolbar, and then drag an appropriate field from the column heading to the Group By Box bar. Within the grouped table view, click the group header bar.  Run the following Outlook Visual Basic for Applications subroutine: Sub SelectionHeader MsgBox Application.ActiveExplorer.Selection.Count End Sub 

The result is zero.

