SendKeys() permission denied error in Visual Basic

后端 未结 9 1629
逝去的感伤
逝去的感伤 2021-01-11 11:14

I am trying to use the SendKeys() command to another window with my VB6 app.

What I wanted is to click a button, and then have 10 seconds to go to the o

9条回答
  •  醉酒成梦
    2021-01-11 11:46

    For Windows 7: Change the UAC settings to never notify.

    For Windows 8 and 10:
    Add this method to any module:

    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 
    

    It's worked fine for me in windows 10.

提交回复
热议问题