편집

다음을 통해 공유


Explorer.RemoveFromSelection method (Outlook)

Cancels the selection of the specified Microsoft Outlook item in the active explorer.

Syntax

expression.RemoveFromSelection (Item)

expression A variable that represents an Explorer object.

Parameters

Name Required/Optional Data type Description
Item Required Object The item to be removed from the selection.

Remarks

The selection in the active explorer is represented by the Selection object returned by the Explorer.Selection property.

To be removed from a selection, an item must be selectable in the current view of the active explorer. However, the item does not have to be visible in the view.

Outlook will return an error when you call the RemoveFromSelection method under the following conditions:

  • The specified item is not in the current view of the active explorer.
  • The specified item is being edited in the current view of the active explorer.
  • The current view has been filtered, and the application of the filter removed the item from the view.
  • The specified item has not been saved.
  • The specified item represents a StorageItem.
  • The current view is a conversation view.
  • No current view exists for the active explorer.

If the specified item is selected, calling RemoveFromSelection will cause the SelectionChange event to fire. If the item is not selected, calling RemoveFromSelection will not cause the SelectionChange event to fire.

Calling RemoveFromSelection does not scroll the view to make the specified item visible in the view and does not expand or collapse groups in the view.

The following table illustrates the results of calling RemoveFromSelection, taking into consideration any current selection (the Selection.Count property), whether the Reading pane is displayed, and whether the specified item is displayed in the Reading pane.

Existing Selection.Count Reading pane displayed Specified item displayed in Reading pane Results
1 Yes Yes
  • The selection is cleared.
  • SelectionChange fires.
  • Reading pane is empty.
>1 Yes No
  • The item is removed from the selection.
  • SelectionChange fires.
  • Reading pane does not change.
>1 Yes Yes
  • The item is removed from the selection.
  • SelectionChange fires.
  • Reading pane displays the next item or adjacent item in the selection.
>=1 No N/A
  • The item is removed from the selection.
  • SelectionChange fires.

If the specified item exists in the current view but is not selected in that view, calling RemoveFromSelection does not result in any change to the selection and does not fire the SelectionChange event.

When you specify an item in a recurring appointment or task as an argument to the RemoveFromSelection method, make sure that before you pass the argument, you obtain an instance of the occurrence by first expanding the recurrences by using the IncludeRecurrences property and the Items collection. If you don't expand the recurrences and obtain an occurrence in the series, you would be passing an instance variable that represents the appointment or task series, and the RemoveFromSelection method would be operating on the series instead of the occurrence.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.