Hi,
You can use the add method for controls. I paste the help below because it
took me quite some time to find it.
=====================================================================
Add Method
Adds or inserts a Tab or Page in a TabStrip or MultiPage, or adds a control
by its programmatic identifier (ProgID) to a page or form.
Syntax
For MultiPage, TabStrip
Set Object = object.Add( [ Name [, Caption [, index]]])
For other controls
Set Control = object.Add( ProgID [, Name [, Visible]])
The Add method syntax has these parts:
Part Description
object Required. A valid object name.
Name Optional. Specifies the name of the object being added. If a name
is not specified, the system generates a default name based on the rules of
the application where the form is used.
Caption Optional. Specifies the caption to appear on a tab or a
control. If a caption is not specified, the system generates a default
caption based on the rules of the application where the form is used.
index Optional. Identifies the position of a page or tab within a
Pages or Tabs collection. If an index is not specified, the system appends
the page or tab to the end of the Pages or Tabs collection and assigns the
appropriate index value.
ProgID Required. Programmatic identifier. A text string with no spaces
that identifies an object class. The standard syntax for a ProgID is
<Vendor>.<Component>.<Version>. A ProgID is mapped to a class identifier
(CLSID).
Visible Optional. True if the object is visible (default). False if
the object is hidden.
Settings
ProgID values for individual controls are:
CheckBox Forms.CheckBox.1
ComboBox Forms.ComboBox.1
CommandButton Forms.CommandButton.1
Frame Forms.Frame.1
Image Forms.Image.1
Label Forms.Label.1
ListBox Forms.ListBox.1
MultiPage Forms.MultiPage.1
OptionButton Forms.OptionButton.1
ScrollBar Forms.ScrollBar.1
SpinButton Forms.SpinButton.1
TabStrip Forms.TabStrip.1
TextBox Forms.TextBox.1
ToggleButton Forms.ToggleButton.1
Remarks
For a MultiPage control, the Add method returns a Page object. For a
TabStrip, it returns a Tab object. The index value for the first Page or Tab
of a collection is 0, the value for the second Page or Tab is 1, and so on.
For the Controls collection of an object, the Add method returns a control
corresponding to the specified ProgID. The AddControl event occurs after the
control is added.
You can add a control to a user form's Controls collection at design time,
but you must use the Designer property of the Microsoft Visual Basic for
Applications Extensibility Library to do so. The Designer property returns
the UserForm object.
The following syntax will return the Text property of the specified control:
userform1.thebox.text
If you add a control at run time, you must use the exclamation syntax to
reference properties of that control. For example, to return the Text
property of a control added at run time, use the following syntax:
userform1!thebox.text
Note
You can change a control's Name property at run time only if you added
that control at run time with the Add method.
=======================================================================
--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
NicoCaps said:
Hi all,
I have userform where users can input a variable which represents a
quantity
of "X" products. I want this variable to be used as an input for another
userform which will display the associated "X" number of text fields.
How can this second userform layout be automatically designed (position of
text fields, alignment, etc)?
I have no code at the moment (excpet for the variable storage in the first
userform) and am looking for a similar post where this subject has already
been treated.
Tanks for your help
Nicolas