I have a .docm
document with a user form. On the user form I have a button that needs to insert something (some text, for starter) at the last known cursor position in the document. For this, I want to create a range.
How can I get the starting position for this range?
Selection
is the current position in the document.Selection.Range
is the Range object of the current Selection
.Range.Start
is the start position of a Range
object (returns or sets a Long).If you combine those three you get the cursor position (or the start of the selection if you have text selected):
Selection.Range.Start
If you only want to enter text att the cursor position the following will do:
Selection.TypeText "Test"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With