Turning NUMLOCK on at the end of a macro run

前端 未结 4 1908
暖寄归人
暖寄归人 2021-01-06 07:01

What code does: I have a code that moves the mouse around the screen, takes printscreens and pastes it to excel.

Problem: For some

4条回答
  •  温柔的废话
    2021-01-06 07:35

    I found this solution so far the best and does not interfere with NUMLOCK. Put below code in a module and call it from anywhere in your project. The script object overwrites the SendKeys in VBA.

    Public Sub Sendkeys(text as variant, Optional wait As Boolean = False)
       Dim WshShell As Object
       Set WshShell = CreateObject("wscript.shell")
       WshShell.Sendkeys cstr(text), wait
       Set WshShell = Nothing
    End Sub 
    

    I found it in below thread:

    SendKeys() permission denied error in Visual Basic

提交回复
热议问题