Sendkeys Page Down not working

Deadly 提交于 2019-12-08 10:17:27

问题


I am trying to send a page down keypress using VBA but nothing I have tried has worked.

I have tried;

Myscreen.SendKeys "{PGDN}"  
Myscreen.SendKeys ("{PGDN}")
Myscreen.SendKeys ("<PGDN>")
Myscreen.SendKeys "{PAGE DOWN}"
Myscreen.SendKeys ("{PAGE DOWN}")
Myscreen.SendKeys ("<PAGE DOWN>")
Myscreen.SendKeys "{PAGE DN}"
Myscreen.SendKeys ("{PAGE DN}")
Myscreen.SendKeys ("<PAGE DN>")
Myscreen.SendKeys "{Down}"
Myscreen.SendKeys ("{Down}")
Myscreen.SendKeys ("<Down>") - this was the only that did anything, but it moved the cursor down a line instead of paging down

I got delete to work using Myscreen.Sendkeys ("") but it doesn't work for page down for some reason.

Does any one have any ideas?


回答1:


The correct Syntax for {Page Down} should be

Option Explicit
Sub sndkey()
    '// to send multiple times try "{PGDN 5}"
    Application.SendKeys "{PGDN}"
End Sub

look at MSDN & SendKeys Class

Edit

okay I have tested it works

Option Explicit
Sub sndkey()
    Dim Myscreen As Object
    Set Myscreen = Sys.Screen
    '// to send multiple times try "{PGDN 5}"
    Myscreen.SendKeys "{PGDN 6}"
End Sub


来源:https://stackoverflow.com/questions/31460447/sendkeys-page-down-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!