Deleting the Active DropDown List

R

Roy Lasris

I have a custom, temporary, tool bar containing 2 drop down (combobox)
lists. I have added in each list an entry called <<Delete>> which, when clicked
by the user, is processed by the OnAction routine to delete the particular
list. (Not just clear it, but remove it from the parent.)

Assuming controls(2) is the 'active' list , this command is invoked

. . .
CommandBars("DropDownLists").Controls(2).Delete
. . .

and I get this result.

Method 'Delete' of Object '_CommandBarComboBox' failed.

It seems that if the active list is the one I am trying to delete, the command
fails. So I have tried to change the focus to the first list or the parent
control, e,g,

CommandBars("DropDownLists").SetFocus
and
CommandBars("DropDownLists").Controls(1).SetFocus

before the delete command is called, neither successfully works. (The focus is
changed, but the delete command returns the above error message.) Any
suggestions? (BTW, I can clear the list without problem, just cannot delete
it.)

Thanks,
Roy
 

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