Why does .extendmode not stay True at end of VBA Sub?

C

Christopher

If .extendmode is True when I enter a VBA Sub, it is always set to
False sometime between the final End Sub and control being returned to
Word. Here is an example:

Public Sub MoveForward4()
' Move point forward 4 characters
Selection.MoveRight Unit:=wdCharacter, Count:=4,
Extend:=wdExtend
End Sub

If .extendmode is True when this Sub is called (it is assigned to
shortcut key), then .extendmode is set to False after the End Sub.

Any suggestions on how I can avoid .extendmode being set to False;
since I don't want the Sub to affect .extendmode.

I also tried implementing this with the .moveend method; but, it too
suffers the same side effect. Lastly, when .extendmode is True, the
cursor keys can be pressed multiple times without .extendmode becoming
set to False; which is the behaviour I'm trying to emulate.

thanks,
Christopher
 
C

Christopher

If .extendmode is True when I enter a VBA Sub, it is always set to
False sometime between the final End Sub and control being returned to
Word. Here is an example:

Public Sub MoveForward4()
' Move point forward 4 characters
Selection.MoveRight Unit:=wdCharacter, Count:=4,
Extend:=wdExtend
End Sub

If .extendmode is True when this Sub is called (it is assigned to
shortcut key), then .extendmode is set to False after the End Sub.

Any suggestions on how I can avoid .extendmode being set to False;
since I don't want the Sub to affect .extendmode.

I also tried implementing this with the .moveend method; but, it too
suffers the same side effect. Lastly, when .extendmode is True, the
cursor keys can be pressed multiple times without .extendmode becoming
set to False; which is the behaviour I'm trying to emulate.

thanks,
Christopher

In answer to my own question, I found the following article at
Microsoft today: http://support.microsoft.com/kb/182257 wherein MS
states that this behaviour is "by design".

The knowledgebase article provides no rationale, and no workaround;
so, I would be obliged if someone _in the know_ was able to provide
some insight. This feature (read "bug") is very frustrating.
 
C

Christopher

Not sure what you're trying to accomplish.

When extendmode is true I want to be able to change the selection area
and then when the Sub returns control to the user I want the user to
be able to continue to change the selection area (without having to
use the shift key to eidt the selection; since shift was not required
prior to the Sub being called).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top