ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PgDn in UserForm (https://www.excelbanter.com/excel-programming/299606-pgdn-userform.html)

Oskar[_2_]

PgDn in UserForm
 
I would like to use PgDn in a userform (to execute sub bnNext_Click). Is this trivial? possible

Apparently onkey doesn't work in userforms and accelerator keys can only be letters. Am I right

Oskar

Vasant Nanavati

PgDn in UserForm
 
Try this (untested):

Private Sub UserForm_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 34 Then bnNext_Click
End Sub

You will also need to put the code in the KeyDown event of any control that
is capable of receiving focus, including bn_Next.

--

Vasant


"Oskar" wrote in message
...
I would like to use PgDn in a userform (to execute sub bnNext_Click). Is

this trivial? possible?

Apparently onkey doesn't work in userforms and accelerator keys can only

be letters. Am I right?

Oskar




Vasant Nanavati

PgDn in UserForm
 
Sorry, Oskar; not quite sure how to do that.

--

Vasant


"Oskar" wrote in message
...
I take back what I said about "working". OK, I get the next record.

However, the "standard event" is executed too!

I.e. in a combo box I get the new record but with a new value in the combo

box (depending on the number of lines defined for that box).

How do I prevent the "standard event" to be executed?

Oskar




Oskar von dem Hagen

PgDn in UserForm
 
Apparently you have to reset the keycode (to 0). See 'Prevent "standard" key event in userform' (http://communities2.microsoft.com/co...figuration.xml

Oska

P.S. The following is just a test for me to see if a shorter reference may work



All times are GMT +1. The time now is 01:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com