View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Prevent "standard" key event in userform

Hi Oskar

If you trap things in the Keydown and/or KeyUp events, set the KeyCode to 0
(zero) while doing it to prevent the default app action. Same thing goes for
KeyAscii in the KeyPress evens.

Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode = 34 Then
KeyCode = 0
MsgBox "Zoot allures"
End If
End Sub

Couldn't find any "PgDn in Userform" so this is very general.

HTH. Best wishes Harald

"Oskar" skrev i melding
...
In found out (see "PgDn in Userform") how to capture the pressing of PgDn

with keypressed and try to use it to read the next record into the form.

Unfortunately, the "standard event" is executed too. I.e. PgDn in a combo

box get the new record (fine) but also changes the value of the combo box
(not fine).

Any way to prevent this?

Oskar

P.S. I don't know if starting a new thread is a correct procedure to draw

(renewed) attention to an old thread. If not, I would like some
illumination.