Click Event Doesn't Fire

D

Dan Mabbutt

I'm trying to create a Click event in Word 2003 VBA. The event doesn't
seem to fire. Here's the ThisDocument VBA code. The other events fire
just fine, but not the Click event. Can anyone tell me why.

' This one does not fire
Private Sub ComboBox1_Click()
MsgBox "click"
End Sub
' All these fire just fine
Private Sub ComboBox1_Change()
MsgBox "change"
End Sub
Private Sub ComboBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
MsgBox "doubleclick"
End Sub
Private Sub ComboBox1_DropButtonClick()
MsgBox "drop button click"
End Sub
Private Sub ComboBox1_GotFocus()
MsgBox "gotfocus"
End Sub
 
D

Doug Robbins

The click event fires when you click on an item in the list of items that
are displayed when the you click on the button at the Right Hand end of the
ComboBox.

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
D

Dan Mabbutt

Yup ... That's right. Thanks, Doug. Dunno why that didn't occur to me.

Just to clarify in case someone else is viewing this stuff, I tested
this by adding some content to the ComboBox. This gave me something to
click on.

Private Sub Document_Open()
ComboBox1.AddItem "aaaaaaaaaa"
ComboBox1.AddItem "bbbbbbbbbb"
ComboBox1.AddItem "cccccccccc"
End Sub

This made it work.

Evidently, if you just have a ComboBox by itself, the null entry that
is there to begin with doesn't trigger the Click event code.
 

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

Top