create activeX component runtime? (i.e checkbox or textbox)

  • I would like to change the look of my userform runtime. I have a userform and depending on which value you choose from some comboboxes the layout should change. I do that by applying the changes in the
    "Sub combobox_Change()", but I still cant find out how to add a checkbox or a textbox........can change the height and the position of existing elements, but not creating new ones?


    I am quite new to VBA, so it probably has to be quite well explained :thanx:


    I had a similar post ealier but I do not think it was clear that I meant runtime....


    Below is a a little paste of this part of my code where I want the changes to appear:



    Thanks in advance.....

  • I'm not sure about creating a new control on the fly like that.. but have you considered "hiding/unhiding" the controls?


    If you need to create a checkbox, you would just have to set the "Visible" property accordingly.



    This is a suggestion, hope it helps

  • Hi,


    Add a command button to a userform and put the following code in the click event.


    This will add a textbox to the userform.

    [h4]Cheers
    Andy
    [/h4]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!