SelectionChange Event
Occurs when the selection of the current view changes. Other selection changes (such as the selected folder) do not cause this event to occur. In addition, this event does not occur if the current folder is a file-system folder or if Outlook Today or any folder with a current Web view is displayed. This event is not available in VBScript.
Sub object_SelectionChange()
object An expression that evaluates to an Explorer object.
Example
This example changes the caption of a form named Form1 to show the number of items selected in the topmost explorer window. The sample code must be placed in a class module, and the Initialize_handler
routine must be called before the event procedure can be called by Microsoft Outlook.
Dim myOlApp As Outlook.Application
Public WithEvents myOlExp As Outlook.Explorer
Public Sub Initialize_handler()
Set myOlExp = myOlApp.ActiveExplorer
End Sub
Private Sub myOlExp_SelectionChange()
Form1.Caption = myOlExp.Selection.Count & " items selected."
End Sub