GetSelection Method Example

The following example returns the locations of the starting and ending points of the current selection in CodePanes(1). The last line in the example uses the GetSelection method to place the four values in the four variables.

Dim m As Long
Dim n As Long
Dim x As Long
Dim y As Long
Application.VBE.CodePanes(1).GetSelection m, n, x, y