View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default RichTexBox1_KeyDown Event Not Working

I should have pasted your code rather than adding the event from the
dropdown. Your example is missing "ByVal" before the Shift

Private Sub Richtextbox1_Keydown(KeyCode As Integer, Shift As Integer)


Private Sub Richtextbox1_Keydown(KeyCode As Integer, ByVal Shift As Integer)

Regards,
Peter T

"Peter T" <peter_t@discussions wrote in message
...
Hi Trip,

Your code works as expected for me. First I get the msgbox then whatever

key
gets added to the text (where the cursor was) in the RTB.

If you are distributing a vba project with a RichTextBox control you might
be interested to read this thread

http://tinyurl.com/ayu97

Regards,
Peter T

"Trip" wrote in message
oups.com...
Hi all,

I'm trying to get the KeyDown event to fire on a RichTextBox. Here's
my test code...

Private Sub Richtextbox1_Keydown(KeyCode As Integer, Shift As Integer)

MsgBox "hello"

End Sub

This is how it would be written in VB. Any suggestions for VBA??
Perhaps I need additional references??

Thanks!

Trip