Refedit Tool - Keypress Event broken?

sodonikus

New Member
Joined
Apr 6, 2013
Messages
2
Hi,

i am trying to code a event to prevent certain keystrokes in a refedit window in my form.
However it does not work for my refedit (but it does for my textbox) and i do not know why.

Private Sub RefEdit1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57
Case 44
If InStr(1, RefEdit1.Text, ",") > 0 Then KeyAscii = 0
Case Else
KeyAscii = 0
End Select
End Sub

Here is a sample of the code i use with Excel 2010. Maybe you know why it does not work or if there is another way
to solve my problem. As i said the exact same code works perfect for textboxes which are used with the parameters:

textbox1_Keypress(Byval Keyascii as MSForms.ReturnInteger)

Best Regards from germany

Sodonikus
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
not sure if this helps any?

The RefEdit Control by default is not available on the Control Toolbox. To locate and add this Control to the Toolbox, right click over any Control on the Toolbox, select Additional Controls and scroll down until you see the Control RefEdit.Ctrl. Simply check the box and click OK. Unfortunately, there is no documentation in the Excel Help for this Control.
 
Upvote 0
No sorry, this is not problem. I added the refedit to the toolbox before, otherwise i could have added it to the form itself. The problem is that refedit supports a event
called "KeyPress" which can be chosen in the code editor (drop down menu in the upper right corner). However it does not work, the event is not triggered if you type a key in the box, but i do not know the reason, since it works for textboxes.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top