![]() |
Call Event as Sub
I have a need to force a ComboBox_Click() event. But, I think I already know
the answer - I just don't like it. The ComboBox_Click() event populates a form. The user has the option to edit some of the controls in the form. Some of these edits will change values in other controls. Therefore, I would like to re-populate the form as if the ComboBox was clicked. The ComboBox_Change() event wasn't working in my situation. When I cleared the ComboBox, it was kicking off the Change() event and I didn't want that. This is why I used Click(). The answer I'm trying to avoid is create a sub that does everything in the ComboBox_Click() event and call it from everywhere I need. -- Adios, Clay Harryman |
Call Event as Sub
Clay,
You should be able to call the Combo box click event handler just like how you would call any sub routine. Private Sub ComboBox1_Click() MsgBox "combo box 1 was clicked!" End Sub Sub test() 'Call ComboBox1_Click ComboBox1_Click End Sub -- Hope that helps. Vergel Adriano "Clayman" wrote: I have a need to force a ComboBox_Click() event. But, I think I already know the answer - I just don't like it. The ComboBox_Click() event populates a form. The user has the option to edit some of the controls in the form. Some of these edits will change values in other controls. Therefore, I would like to re-populate the form as if the ComboBox was clicked. The ComboBox_Change() event wasn't working in my situation. When I cleared the ComboBox, it was kicking off the Change() event and I didn't want that. This is why I used Click(). The answer I'm trying to avoid is create a sub that does everything in the ComboBox_Click() event and call it from everywhere I need. -- Adios, Clay Harryman |
Call Event as Sub
Found the problem:
ComboBox_Click() was in another form than the one with which I had problems. I made it Public rather than Private and it worked. -- Adios, Clay Harryman "Vergel Adriano" wrote: Clay, You should be able to call the Combo box click event handler just like how you would call any sub routine. Private Sub ComboBox1_Click() MsgBox "combo box 1 was clicked!" End Sub Sub test() 'Call ComboBox1_Click ComboBox1_Click End Sub -- Hope that helps. Vergel Adriano "Clayman" wrote: I have a need to force a ComboBox_Click() event. But, I think I already know the answer - I just don't like it. The ComboBox_Click() event populates a form. The user has the option to edit some of the controls in the form. Some of these edits will change values in other controls. Therefore, I would like to re-populate the form as if the ComboBox was clicked. The ComboBox_Change() event wasn't working in my situation. When I cleared the ComboBox, it was kicking off the Change() event and I didn't want that. This is why I used Click(). The answer I'm trying to avoid is create a sub that does everything in the ComboBox_Click() event and call it from everywhere I need. -- Adios, Clay Harryman |
All times are GMT +1. The time now is 10:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com