Getting Keydown(key) for PageDown & Up

I would like to capture the keydown key for pagedown and pageup.
I have tried to use Keyboard.AsyncKeyDown(74) and (79) followed by Return False with a breakpoint there.
I’m not getting results.

If Keyboard.AsyncKeyDown(74) Then//PageUp Return False//breakpoint here ElseIf Keyboard.AsyncKeyDown(79) Then//PageDown Return False//breakpoint here End If
Suggestions?

where did you put this code into ? which event ?
it should be in a keydown event
put a breakpoint there and see what is inside the parameter Key to get the good code.

Your values are the hex values, not decimal. Use 116/121, or use the &h notation to pass the hex values (&h74/&h79).

My problem is I am using a Mac Laptop which doesn’t have a pagedown. You use Fn+ArrowKey which is what I get.

the ASCB values are 28 thru 31 if I recall for use in KEYDOWN

Note the difference between AsyncKeyDown and KeyDown, you likely don’t want the Async one.

I just tested Keyboard.AsyncKeyDown(&h79) on my PC which has a normal keyboard. and it works.

Just for clarification, I am also asking because one isn’t supposed to use async in the Keydown event.

It could be I haven’t rebooted my laptop in a while but not likely.

Here’s a demo project that shows how to do this with both the Event and the Async functionality.
Working fine with 2018r3, Mac 10.14, En-US keyboard.

pagedown.xojo_binary_project

Thanks. It works and I can capture it in KeyDown.

I wonder what is going on.

Thanks Tim. In your example you used

select case asc(Key) case 11
I was missing the ascii 11.