How does one assign selected text to a variable without using the clipboard.
v := ?SelectedText
?
What you have written does the job.
Choose Options>Compile with Debug
In your macro, at the end, add
Display(On!) Step(On!)
Run the macro
Your variable v is included in the list of variables.