Application.Sendkeys Fails Sending Special Characters (138471)



The information in this article applies to:

  • Microsoft Excel for Windows 95

This article was previously published under Q138471

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

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbProgramming KB138471