INFO: Visual Basic SendKeys Statement Is Case-Sensitive

This article was previously published under Q81466
This article has been archived. It is offered "as is" and will no longer be updated.
The SendKeys statement in Microsoft Visual Basic for Windows is case-sensitive with regards to the keystrokes sent. Sending an uppercaseletter may be interpreted by the receiving application differentlythan the lowercase version of a letter.
More information
The following line of code sends an ALT+F key combination to theapplication that currently has the focus:
   SendKeys "%(F)"				
NOTE: This is different from ALT+F:
   SendKeys "%(f)"				
This can be a problem because some applications distinguish between anuppercase 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, MicrosoftWord version 2.0 for Windows does distinguish the lowercase f sent bySendKeys.

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

Article ID: 81466 - Last Review: 10/26/2013 04:19:00 - Revision: 3.0

  • Microsoft Visual Basic 2.0 Standard Edition
  • Microsoft Visual Basic 3.0 Professional Edition
  • Microsoft Visual Basic 2.0 Professional Edition
  • Microsoft Visual Basic 1.0 Standard Edition
  • kbnosurvey kbarchive kbinfo kbprogramming KB81466