XL7: Application.Sendkeys Fails Sending Special Characters

Last reviewed: September 2, 1997
Article ID: Q138471
The information in this article applies to:
  • Microsoft Excel for Windows 95, version 7.0

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 PgmOthr xlwin kbcode kbusage
Version : 7.00
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.