PDA

View Full Version : Can't view the endnotes pane from a macro run from a shortcut ("Text") menu - odd!



johndavidson
08-07-2014, 02:53 AM
This is a strange one and ultra-easy to demonstrate. An issue with some code I have written in VBA/Word 2003 is demonstrated by this little routine:

Sub Test()
ActiveDocument.ActiveWindow.View.Type = wdNormalView
Application.ActiveDocument.ActiveWindow.View.SplitSpecial = wdPaneEndnotes
End Sub

If run from a hotkey, main menu item, or toolbar icon, it works just fine. The endnotes pane is displayed.

BUT, if I insert an item in the main "Text" (right-click) shortcut menu and run the routine from there, then it fails on the second statement in the routine, giving "Error 4605 - This command is not available".

Assuming that it is something to do with the shortcut menu still having the focus, I've tried a variety of things to disengage it (dis-enabling the "Text" commandbar, making it not visible, even <SendKeys "{esc}", True> ), but nothing works. The error message remains the same.

Any ideas/solution would be much appreciated.

John Davidson