Cancel Key Press Event

D

DZ

How can I cancel the Key Press Event in a Excel 97 Combo Box from Controls
Toolbar.

The Event Procedure is

Private Sub cboField_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)

End Sub

What I want to do is prevent the user from entering any text into the combo
box, because the combo box is for making selections only, not entering new
values.

In Access, I would use the Docmd.Cancel Event, but there should be a way to
accomplish the same thing in Excel

Thank you
 
D

Dave Peterson

I think it would make more sense (as a user) to change the .style property to
fmStyleDropDownList (it won't allow new entries) and change the .matchrequired
property to true (and maybe change the .matchentry to fmMatchEntryComplete (to
help choose from the list)).

But you could use
KeyAscii= 0
(but that doesn't seem very user friendly to me.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top