Application.Selection property (Publisher)

Returns a Selection object that represents a selected range or the cursor.

Syntax

expression.Selection

expression A variable that represents an Application object.

Example

This example tests whether the current selection is text. If it is text, the selected text is then displayed in a message box.

Sub Selectable() 
 
 If Selection.Type = pbSelectionText Then MsgBox Selection.TextRange 
 
End Sub

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.