Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default RichTexBox1_KeyDown Event Not Working

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default RichTexBox1_KeyDown Event Not Working

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default RichTexBox1_KeyDown Event Not Working

Bingo!! Sorry for the additional post - this came in as I was writing.

Thanks! That did it!

Trip

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default RichTexBox1_KeyDown Event Not Working

Thanks for checking-out my code Peter! I have the RICHTX32.OCX
reference, yet, when I try to launch the form I get:

"Compile error: procedure declaration does not match description of
event or procedure haveing the same name"

Any further ideas??

Thanks,

Trip



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default RichTexBox1_KeyDown Event Not Working

Thanks for checking-out my code Peter! I have the RICHTX32.OCX
reference, yet, when I try to launch the form I get:

"Compile error: procedure declaration does not match description of
event or procedure haveing the same name"

Any further ideas??

Thanks,

Trip

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
worksheet change event not working Jase Excel Discussion (Misc queries) 2 October 27th 08 03:45 PM
before print event not working goss[_17_] Excel Programming 2 January 29th 04 03:54 AM
Workbook_Open event not working jason Excel Programming 2 September 7th 03 04:02 PM
Worksheet_Change Event Not Working Michael Beckinsale Excel Programming 0 August 1st 03 02:43 PM


All times are GMT +1. The time now is 06:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"