I develop Word add-ins for copyeditors and such. Many of my macros depend on being able to extend a text selection. However, the following commands no longer work at all, even if the add-in isn't loaded:
Selection.Extend
Application.Run MacroName:="ExtendSelection"
Selection.ExtendMode = True
This problem started after I assigned ExtendSelection to a custom keyboard shortcut in my add-in. At first it worked. Then it didn't. Now it actually crashes Word. Again, this is true even if no add-ins are loaded, and even after deleting the Normal.dotm template and starting again from scratch.
If I just press the F8 key, *then* ExtendSelection is turned on and works. But if I try to use the feature in a macro, using any of the above commands, I get nothing.
I've been writing macros for many years, so I know my way around VBA pretty well, but this is one of the weirdest things I've ever seen.
I know all about using Ranges vs. Selections, but sometimes I want the user to interact with the text, which means using Selection is sometimes necessary. When the macro has done its thing, I want to end the macro with Extend turned on for the user.
I really need to be able to use the feature using a macro. Any ideas about how to solve the problem? Thanks very much for any help.
Update: I see the same problem even if I start Word in Safe Mode.
I've been working mainly in Word 365, but I just tested in Word 10 and in Word 2003, with the same problem: Selection.Extend doesn't work. Maybe this is a Windows problem?
|