elkor
asked on
Again: SendKeys and Word
it's don't work:
Shell "WinWord", vbMaximizedFocus
DoEvents
SendKeys "%FO", True
__________________________ _____
it's works:
Shell "Excel", vbMaximizedFocus
DoEvents
SendKeys "%FO", True
Why? :)
Shell "WinWord", vbMaximizedFocus
DoEvents
SendKeys "%FO", True
__________________________
it's works:
Shell "Excel", vbMaximizedFocus
DoEvents
SendKeys "%FO", True
Why? :)
ASKER
to JDettman:
no, it's doesn't work :(
__________________________ __________ _____
for example next statment works:
Shell "WinWord", vbMaximizedFocus
DoEvents
SendKeys "%{F4}", True
no, it's doesn't work :(
__________________________
for example next statment works:
Shell "WinWord", vbMaximizedFocus
DoEvents
SendKeys "%{F4}", True
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
to perove:
yes, it's works :)
yes, it's works :)
This is an odd bug in Word 97 that you've uncovered.
All the top-level menus in Word respond as normal to the Alt+Key , Alt-E for Edit, Alt-O for format etc. i.e. those key combinations drop down the corresponding menu. The exception is that Alt-F does NOT open the File menu, instead it just selects it on the menu bar!
This SendKeys sequence works...
Shell "winword", vbMaximizedFocus
SendKeys "%f{down}o"
Note that there is no need for DeEvent, it works as is. Note also that it's CASE SENSITIVE , you have to use a lowercase 'f'. Go figure!!!
All the top-level menus in Word respond as normal to the Alt+Key , Alt-E for Edit, Alt-O for format etc. i.e. those key combinations drop down the corresponding menu. The exception is that Alt-F does NOT open the File menu, instead it just selects it on the menu bar!
This SendKeys sequence works...
Shell "winword", vbMaximizedFocus
SendKeys "%f{down}o"
Note that there is no need for DeEvent, it works as is. Note also that it's CASE SENSITIVE , you have to use a lowercase 'f'. Go figure!!!
To make that clear, you may find that on a different PC, even the Excel won't work.
To see if it is a timing issue, paste the function below into a module, then add:
intRet = Wait(15)
Before the SendKeys. If that doesn't work, then it's something else.
Jim.
Function Wait(intSeconds As Integer) As Integer
Dim datCurDateTime As Date
datCurDateTime = Now
Do Until DateDiff("s", datCurDateTime, Now) > intSeconds
DoEvents
Loop
End Function