Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Determining if Caps Lock is On.
by Allen Wyatt
(last updated December 3, 2016)
When you are creating a macro, you may have a need to know if the Caps Lock key is engaged. (For instance, you may want to warn a user to turn the Caps Lock key off.) If you have this need, the following VBA macro code determines the status of the Caps Lock key, and warns you accordingly:
If Selection.Information(wdCapsLock) Then MsgBox "The Caps Lock key is on" Else MsgBox "The Caps Lock key is off" End If
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (11995) applies to Microsoft Word 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Word here: Determining if Caps Lock is On.
Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!
Functions can be used to perform repetitive tasks and return values to your main program. You can also pass values to a ...Discover More
When you format a document, you can go so far as to change the font of each character in the document. This may be ...Discover More
The heart of creating powerful programs in VBA is to understand how to create subroutines. These structures allow you to ...Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.