View Single Post
 
Old 01-26-2023, 09:27 AM
coffent coffent is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Dec 2019
Posts: 40
coffent is on a distinguished road
Default Using SendKeys in a VBA subroutine toggles NumLock

I have added a subroutine call to the context-sensitive right-click menu in Excel. For purposes of my question, I've reduced the subroutine to:

Sub Test()
SendKeys("x")
End Sub

In this case, the subroutine simply puts an "x" in the active cell. However it inexplicably also toggles the NumLock status (from on to off or from off to on). No matter what keys are substituted for "x", NumLock is toggled. The only SendKeys statement that doesn't toggle NumLock is SendKeys(""), i.e., a null.

What could be causing this bizarre behavior?
Reply With Quote