PDA

View Full Version : Solved: CAPS LOCK Balloon Message



tools
01-12-2009, 06:08 AM
HI All,

Is it possible to display a balloon message in an excel form ?

for eg :

when the caps lock is on and we lock our computers a ballon message is displayed saying caps lock is on .

Something of that sort.

I dunt want a message box to be displayed.

Thanks & Regards

mikerickson
01-12-2009, 06:47 AM
A userform could be displayed with only a Label and no buttons. It would be dismissed by clicking the X.
I don't see the advantage of that over a message box, but it would work.

Testing for Caps Lock from VBA would involve API functions.

Bob Phillips
01-12-2009, 07:19 AM
Testing for Caps Lock from VBA would involve API functions.
Very simple though


Private Declare Function GetKeyState Lib "user32" _
(ByVal fnKey As Long) As Integer

Private Const vkCAPITAL As Long = &H14

Public Function CapsLockOn() As Boolean
CapsLockOn = (GetKeyState(vkCAPITAL) And 1 <> 0)
End Function

tools
01-12-2009, 08:23 PM
Thanks xld and Mikerickson ,

But my requirement is to display a balloon I have detected if the caps lock is on or not.

If you could let me know how to implement API functions or if there is any link that would provide some help?

Thanks & Regards

georgiboy
01-13-2009, 07:27 AM
Using XLD's function you could use something like...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Column = 1 Then '<Change for your needs
If CapsLockOn = True Then MsgBox "Caps is on"
End If

End Sub
Hope this helps

Kenneth Hobs
01-13-2009, 09:25 AM
You mean that the balloon does not show? If I leave caps on, I get a light. If that is not clue enough, the balloon message shows in the Alt+Ctrl+Del dialog when it is locked.

If your balloon is not showing, you may have this Windows option disabled.

I guess the best option would be to unlock caps in a logoff macro but I dislike changing what a user has set for themselves.

tools
01-19-2009, 05:08 AM
I want to display the baloon message in my custom form.
It is being displayed in the Alt+Ctrl+Del dialog.

georgiboy
01-19-2009, 06:02 AM
Im not sure about a baloon but here might be a workaround to display a message in a form when capslock is on...

tools
01-19-2009, 08:19 PM
Luks good
Thanks georgiboy :)