I'm writing a macro to let me replace the spaces in a string in my code file with underscores. I've gotten as far as finding the beginning and end of the string as instances of VirtualPoint
. Now I'm trying to select from the first VirtualPoint
to the second. And I can't figure it out.
I know the VirtualPoint
s are correct, because I'm using MessageBox.Show to tell me their values when I run the macro. I just don't know the correct command to set the TextSelection
from the first to the second. I've tried this:
selection.MoveToPoint(firstVirtualPoint)
selection.MoveToPoint(secondVirtualPoint, True)
This seems like it ought to work, but it doesn't. The cursor just moves to the end of the line (as far as I can tell).
Does anybody know the correct command for doing this?