Microsoft KB Archive/81466

= INFO: Visual Basic SendKeys Statement Is Case-Sensitive =

Article ID: 81466

Article Last Modified on 12/12/2003

-

APPLIES TO


 * Microsoft Visual Basic 2.0 Standard Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 2.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 1.0 Standard Edition

-



This article was previously published under Q81466



SUMMARY
The SendKeys statement in Microsoft Visual Basic for Windows is case- sensitive with regards to the keystrokes sent. Sending an uppercase letter may be interpreted by the receiving application differently than the lowercase version of a letter.



MORE INFORMATION
The following line of code sends an ALT+F key combination to the application that currently has the focus: SendKeys &quot;%(F)&quot; NOTE: This is different from ALT+F: SendKeys &quot;%(f)&quot; This can be a problem because some applications distinguish between an uppercase F and lowercase f when sent by the SendKeys statement.

For example, Microsoft Word versions 1.0b and earlier for Windows (WINWORD.EXE) do not distinguish the difference. However, Microsoft Word version 2.0 for Windows does distinguish the lowercase f sent by SendKeys.

When SendKeys (from Visual Basic for Windows) sends the ALT+F key combination, WINWORD.EXE version 2.0 interprets the keystroke as ALT+Shift+f, at which Word for Windows will simply beep. However, SendKeys using ALT+f will correctly activate the File menu.

Keywords: kbinfo kbprogramming KB81466

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.