Visual Basic SendKeys Statement Is Case Sensitive

ID Number: Q81466

1.00

WINDOWS

Summary:

The SendKeys statement in Visual Basic 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.

This information applies to Microsoft Visual Basic programming system

version 1.0 for Windows.

More Information:

The following line of code sends an ALT+F key combination to the

application that currently has the focus:

SendKeys "%(F)"

Note that this is different than ALT+f:

SendKeys "%(f)"

This can be a problem because some applications distinguish between an

uppercase F and lower case f when sent by the SendKeys statement.

For example, Microsoft Word for Windows (WINWORD.EXE) versions 1.0b

and earlier do not distinguish the difference. However, Microsoft Word

for Windows version 2.0 does distinguish the lowercase f sent by

SendKeys.

When SendKeys (from Visual Basic) 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.

Additional reference words: 1.00