Sendkeys Page Down无效

时间:2015-07-16 17:06:36

标签: excel vba sendkeys pagedown

我正在尝试使用VBA向下发送按键,但我尝试过的任何内容都没有用。

我试过了;

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

我使用Myscreen.Sendkeys(“”)删除了工作,但由于某种原因它不适用于页面向下。

有人有任何想法吗?

2 个答案:

答案 0 :(得分:0)

{Page Down}的正确Syntax应为

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

查看MSDN&amp; SendKeys Class

修改

好吧我已经测试过了吗

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

答案 1 :(得分:-1)

这是正确的语法Myscreen.SendKeys ("<rollup>")