XL7: Application.Sendkeys Fails Sending Special Characters

ID: Q138471

The information in this article applies to:

SYMPTOMS

When you attempt to use the Sendkeys method with the Application object in Visual Basic for applications to send special characters (such as letters in international alphabets, accents, currency symbols, and fractions) to Microsoft Excel, the code may appear to be ineffective. Specifically, the following line of code appears to not send any keystrokes:

   Application.SendKeys "e"

NOTE: The e character is created by the ALT+0233 key combination. The numbers must be entered from the numeric keypad.

WORKAROUND

To send the special character, use the Visual Basic for applications Sendkeys method instead of the Microsoft Excel Sendkeys method. The following line of code will send the special character:

   Sendkeys "e"

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The SendKeys command sends one or more keystrokes to the active window as if the keystroke was entered from the keyboard. Each key is represented by one or more characters. To specify a single keyboard character, use the character itself. For example, to represent the letter A, use "A" for the string. If you want to represent more than one character, append each additional character to the one preceding it. To represent the letters A, B, and C, use "ABC" for the string. The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses ( ) have special meanings to SendKeys. To specify one of these characters, enclose it in braces. For example, to specify the plus sign, use {+}. Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces as well, because in other programs, brackets do have a special meaning that may be significant when you use dynamic data exchange (DDE). To send brace characters, use {{} and {}}.

REFERENCES

"Microsoft Excel 5 Visual Basic for Applications Reference," pages 107-110, Microsoft Press

Additional query words: 7.00 keystroke programs

Keywords          : kbprg xlwin 
Version           : 7.00
Platform          : WINDOWS

Last Reviewed: September 3, 1997