PRB: SendKeys May Return Illegal Function Call Error (87773)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 2.0
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 2.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
- Microsoft Visual Basic Standard Edition for Windows 1.0
This article was previously published under Q87773 SYMPTOMS
The SendKeys statement reports the error "Illegal function call" when
its argument contains an incorrectly formatted string. This article
describes specific circumstances that cause this error, and contains
a code example that shows how to send any string with SendKeys.
CAUSE
The following characters have special meaning to the SendKeys statement:
+ ^ % ~ ( ) [ ] { }
The SendKeys statement reports an "Illegal function call" error if its
argument contains one of the following, not enclosed in braces: - An unmatched parenthesis () or bracket {}
- A bracket []
- Braces containing an undefined character sequence, such as {abc}
RESOLUTION
To prevent the SendKeys statement from interpreting a character,
enclose the character in braces {}. For example, to send the string
The interest rate is 5% (annually).
Use the following SendKeys syntax:
SendKeys "The interest rate is 5{%} {(}annually{)}."
REFERENCES
"Microsoft Visual Basic: Language Reference," version 1.0, pages 283-284
Modification Type: | Major | Last Reviewed: | 12/12/2003 |
---|
Keywords: | kbprb KB87773 |
---|
|