I have looked all over the internet and I can't seem to find this assistance.
I am trying to write some vba code that adds controls to the user form with a click of the button. At the moment I can add the controls just fine with
separate sub:
What I need is while the controls are created I want to write the following code to the project for each textbox created
or something like it.
I would write a function for it but I can't seem to figure that one out either.
Thanks in advance.
I am trying to write some vba code that adds controls to the user form with a click of the button. At the moment I can add the controls just fine with
Code:
Option Explicit
Dim CountPartNumber As Integer
Dim PartNumberTop As Long
Private Sub CommandButton1_Click()
CountPartNumber = CountPartNumber + 1
PartNumberTop = PartNumberTop + 24
Me.Controls.Add "Forms.textbox.1", "HeatNumber" & CountPartNumber
With Controls("HeatNumber" & CountPartNumber)
.Top = PartNumberTop
.Left = HeatLeft
.Width = HeatWidth
End With
Code:
sub Private Sub UserForm_Initialize()
......
CountPartNumber = 1
PartNumberTop = 30
........
What I need is while the controls are created I want to write the following code to the project for each textbox created
Code:
.value = StrConv(.value, vbUpperCase)
I would write a function for it but I can't seem to figure that one out either.
Thanks in advance.