Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
What's the syntax error with this SendKeys code?
Why is it I can never understand the syntax mentioned in VBA Help?
I'm trying to use send keys at the moment and VBA help says as an example to press Alt-F-X Application.SendKeys("%fx") So when I try and use Alt-F4 to exit WinAmp I type the code: C:\Program Files\Winamp\winamp.exe.SendKeys("%{f4}") and the moment I move to another line it comes up with the error message: "Compile error: Expected: line number or statement or end of statement" and it highlights the first "backslash \". Judging from other code experts on this site have taught me, I would have guessed "speach marks" should go around the path to the application, but that doesn't work and VBA help doesn't suggest it. Thanks in advance Phil |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
What's the syntax error with this SendKeys code?
you wouldn't use winapp. You litterally use the word "Application" which
refers to Excel. Sendkeys sends the keystrokes to the active application (the window with the focus). Just as a caution and it may not be an issue for you, but If you do it right after a shell command, You might want need to employ the WAIT command beforw sendkeys. -- Regards, Tom Ogilvy "Phil1982" wrote in message ... Why is it I can never understand the syntax mentioned in VBA Help? I'm trying to use send keys at the moment and VBA help says as an example to press Alt-F-X Application.SendKeys("%fx") So when I try and use Alt-F4 to exit WinAmp I type the code: C:\Program Files\Winamp\winamp.exe.SendKeys("%{f4}") and the moment I move to another line it comes up with the error message: "Compile error: Expected: line number or statement or end of statement" and it highlights the first "backslash \". Judging from other code experts on this site have taught me, I would have guessed "speach marks" should go around the path to the application, but that doesn't work and VBA help doesn't suggest it. Thanks in advance Phil |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SendKeys syntax problem | New Users to Excel | |||
variable not declared error & syntax error | Excel Programming | |||
Syntax Error in VLOOKUP Code | Excel Programming | |||
help with code/syntax | Excel Programming | |||
Syntax Error Runtime Error '424' Object Required | Excel Programming |