PDF转Excel:高效去除AI特征,实现数据自由编辑
776
2022-12-03
如何用VBA检查Caps Lock键是否打开
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As IntegerConst VK_NUMLOCK = &H90Const VK_SCROLL = &H91Const VK_CAPITAL = &H14Private Sub KeyStates()If GetKeyState(VK_CAPITAL) Then ‘Caps Lock键MsgBox "Caps Lock ON"ElseMsgBox "Caps Lock OFF"End If
If GetKeyState(VK_NUMLOCK) Then ‘Num Lock键MsgBox "Num Lock ON"ElseMsgBox "Num Lock OFF"End IfIf GetKeyState(VK_SCROLL) Then ‘Scroll Lock键MsgBox "Scroll Lock ON"ElseMsgBox "Scroll Lock OFF"End IfEnd Sub
另外,在Word中可以使用下面的VBA代码来判断Caps Lock键是否开启:
Sub KeyStates()If Selection.Information(wdCapsLock) ThenMsgBox "Caps Lock 键已开启"ElseMsgBox "Caps Lock 键已关闭"End IfEnd Sub
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。