views:

133

answers:

2

is it possible to change a combo box to text box using vba?

+1  A: 

As far as I know there are two methods. If the form is in design mode then running;

Application.RunCommand acCmdChangeToTextBox

while the combobox is in focus will make it turn into a textbox.

However you cannot do this at runtime. Say you want to show a textbox after selecting a value from the combobox, on the Change event of the combobox you just hide it and show a textbox that was previously hidden. Use the visible property of the combobox and the textbox for this.

Sivakanesh
+1  A: 

As an addition to the suggestion about hiding the text box I have seen people use a text box to cover all but the dropdown arrow of the combo box (text box set to be on top of course) and then updated the text box on the after update event of the combo box

I forget why they did it that way in the end but it worked and IMHO is better than hiding the combo box as you might have issues with it still having focus

Kevin Ross