F
filo666
Hello, Is there a way to set a variable with the possition of the last word
changed???
last word selected???
TIA
changed???
last word selected???
TIA
You need to define your requirements more. Define "last word".
Say you have (as text):
"the quick brown fox
yadda yadda"
Say you move the selection to the "w" of "brown", and type "greeeee"
"the quick browgreeeeen fox
yadda yadda"
Now say you move the Selection (cursor) to the second "yadda", and run:
Selection.GoTo what:=wdGoToBookmark, Name:="\PrevSel1"
the Selection (cursor) will move to the last "e" of the "greeeee" you typed.
Now, say you actually select "quick"...but you do NOT do any action. You
just selected it....then changed your mind, and moved the cursor to that
second yadda. Remember, you DID select "quick".
Selection.GoTo what:=wdGoToBookmark, Name:="\PrevSel1"
will STILL go the the last "e" of the "greeeee" you typed. Even though the
last selection was "quick". If you DO something with "quick", then PrevSel1
will go back to it. If you just select it, but do nothing, it won't.
What I am saying is you have to clearly define exactly what it is you want to
do.
Last word changed? Yes, you could use PrevSel1 and then expand the Selection
to the whole word - if it was not the whole word in the first place. if the
previous Selection WAS the whole word, then PrevSel1 would get the whole word.
But typing is not a whole word. PrevSel1 goes to the last location as a
single character.
[quoted text clipped - 4 lines]Look at the builtin bookmark "\PrevSel1".