Thread: Combo Grief
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
BrianB BrianB is offline
external usenet poster
 
Posts: 109
Default Combo Grief

I guess if you want to override one of Excel's features you have to
write your own. This was an interesting exercise - perhaps you can
adapt it to what you want :-

'------------------------------------------------------
'- This is Test code - hence bad programming technique
'- The _Change event fires as each character is typed.
'------------------------------------------------------
Private Sub ComboBox1_Change()
Dim MyArray As Variant
Dim Valid As Boolean
MyArray = Array("AAAA", "AABB", "AAAC")
cb1 = ComboBox1.Value
Ln = Len(cb1)
Valid = False
'- check
For n = 0 To 2
If cb1 = Left(MyArray(n), Ln) Then Valid = True
Next
If Valid = False Then
MsgBox ("Please use type a valid entry")
ComboBox1.Value = Left(cb1, Ln - 1)
End If
End Sub
'--------------------------------


Regards
BrianB
=========================================


"Kevin McCartney" wrote in message ...
Hi, I have a combo box on a form, its populated with an
array and the most important settings for the combo box
which I think my problem relates to a
MatchEntry: 1 - frmEntryComplete
MatchRequired: True.

If I type in any old rubish so as not to match an entry I
get the message 'Invalid property value', but I'd like to
change this message but can't find or know where to
replace this message. I thought of some sub procedure like
a Not In List similar to Access, thus if no match clear
the entry and ask the user to try again.

Thank for you help