Determining Selected Mail Items

D

DENNIS BROWN

If I want to use VBA to get the count and text of selected items within the current folder, what would be some syntax possibilities?
For example, the user selects items 1, 7, 12, 17, 21, 23-29, and 35, in preparation to take an action on those items (i.e. delete, move, etc.), how would I get the count, and the text to those items, if I wanted to save the count and text in a couple of variables for future use?
 
S

Sue Mosher [MVP-Outlook]

Application.ActiveExplorer.Selection is the collection of all selected items. Selection.Count gives you the count. Iterate the collection to return each item in turn. If you plan to move or delete, use a countdown For ... Next loop.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


If I want to use VBA to get the count and text of selected items within the current folder, what would be some syntax possibilities?
For example, the user selects items 1, 7, 12, 17, 21, 23-29, and 35, in preparation to take an action on those items (i.e. delete, move, etc.), how would I get the count, and the text to those items, if I wanted to save the count and text in a couple of variables for future use?
 
D

DENNIS BROWN

Works great! Thanks.

--

Thanks,
Dennis
Application.ActiveExplorer.Selection is the collection of all selected items. Selection.Count gives you the count. Iterate the collection to return each item in turn. If you plan to move or delete, use a countdown For ... Next loop.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


If I want to use VBA to get the count and text of selected items within the current folder, what would be some syntax possibilities?
For example, the user selects items 1, 7, 12, 17, 21, 23-29, and 35, in preparation to take an action on those items (i.e. delete, move, etc.), how would I get the count, and the text to those items, if I wanted to save the count and text in a couple of variables for future use?
 
Top