Macro Reference — Tutorial — Get a Selected String (Tutorial)

# Get a Selected String (Tutorial)

To get a selected string, use Text Property.

The following example demonstrates how to get a selected string and display it.

## [JavaScript]

    str = document.selection.Text;
    alert( str );

## [VBScript]

    str = document.selection.Text
    alert str

Previous topic: Save Macro (Tutorial)

Next topic: Get the Name of a Computer User (Tutorial)