0
votes

I am creating a userform in Word VBA that only has one combobox named cboType and one command button named cmdNext. In default, cboType have Null value and cmdNext is disabled.

I use cboType_Change event so that when an item is selected from the combobox, cmdNext is enabled and the combobox value is stored to a variable Type. However, I have another sub that will remove each item in cboType when cmdNext is clicked. I find out that removing item also fire the cboType_Change. I don't want this to happen because it will also change the value in variable Type.

In order to overcome this, I have tried using cboType_AfterUpdate event instead of cboType_Change, but I found out that this event will be fired only if the focus moved from cboType (cmiiw). Meanwhile, I don't have any other active/enabled control in the userform, so the cboType_AfterUpdate event won't be fired (the combobox value won't be stored to variable Type and cmdNext won't be enabled).

Any suggestion on how to do this?

1

1 Answers

0
votes

If you just want the function to be called, can't you use

Call cboType_AfterUpdate()

to call this manually when the user clicks the cmdNext button? Not sure if this solves your initial problem that cboType_Change is called when you change some value in the combobox.