SendMenusTo Not Working
Keywords: SendMenusTo
Question:
I am trying to use the SendMenusTo command with Microsoft Word97 and MSOFFICE 97 (Specifically Extra )(WinNT) and it tells me that the Window menu not accessible.I'm trying to send menus to the MS Internet Explorer, as in:
SendMenusTo("~Microsoft Internet Explorer", "Help Help Topics")works as expected. ButSendMenusTo("~Microsoft Internet Explorer", "View Options")doesn't. What's going on?Also, I am having trouble with the SendMenusTo failing to execute with MS Word. The interesting part is that if the Word window does not exist and my process opens it up before doing the send menu, it works. But if the window already exists, Word acts like it never saw the commands.
Answer:
Yes. Word menus are strange and unreliable. Use SendKeysTo instead.The problems is that sometimes the menu items are NOT there until you click on the menu, and then Word rapidly makes and displays them. This will make SendMenusTo fail. So use SendKeysTo instead.
Some applications, especially the new ones out of Microsoft build menus "on the fly" when you click on the menu item. The problem is that the menu item simply does not exist (sometimes) when you do the SendMenusTo, so we can't find it. Your only recourse at this point is to use SendKeysTo instead.
A lot of the menu items in Office 95/97 (in Word, Excel, PPT, etc.) don't actually exist until you pull down the menu item. Then Word (or whatever) scurries around and builds the menu. As a consequence, they don't actually exist for a SendMenusTo.
In addition, we're having problems with the SendMenus functions in Windows98. It seems most of the new Microsoft stuff does not even use real menus anymore (as defined by the WIndows API) but rather some text based button bar instead.
It seems we can see the menus in *some* applications but not others. So we're still kicking it around.
Question (thread continued):
How can I send the ALT+key combinations that I need to access the menu using SendKey?Answer:
Assuming you want to access File Open it would be something like:SendKeysTo("Microsoft Word","!fo")
Article ID: W13110Filename: SendMenusTo Not Working.txt