Re: A modified (better?!) solution
Hi,
Here is a small change you need to make in order to *totally* remove the
popping up of default option in the list. But if i were the user i would rather
have the default option also listed! :-)
If you have already figured this out, then please excuse me.
Change these two routines a little : The technique remains same : i.e add your default option to the list and select that list index. Preferable to add it in the end. Catch the DropDown event and see if the value is default value is present in the list, and remove it. Automatically the textbox area also gets cleared. You user will never see the default option. May be ideal if you are using it as a hint, like "Please select again---", than as option...
Private Sub Combo1_Click()
Static dontprocessclick As Boolean
If dontprocessclick Then Exit Sub
With Combo1
If Check1.Value = 1 Then
' add these 3 new lines:
If .List(.ListCount - 1) "*Today*" Then
.AddItem "*Today*", .ListCount
End If
If .ListIndex .ListCount - 1 Then
dontprocessclick = True
MsgBox ("This selection Not allowed under this condition")
.ListIndex = .ListCount - 1
dontprocessclick = False
End If
End If
End With
End Sub
Private Sub Combo1_DropDown()
With Combo1
If .List(.ListCount - 1) = "*Today*" Then
.RemoveItem .ListCount - 1
End If
End With
End Sub
Regards,
Ravi