Hi there,
I have one question about dynamic TextBox.
I wrote two different functions, which adding to MultiPage two different TextBoxes - first function adding TextBox in one column and fill up automatically with letters and numbers (red frame on picture), second function adding an empty TextBox, where I want to put my comments (green frame on picture). On MultiPage I put one TextBox for counting, how much TextBox I want to fill.
I want to have a text from TextBoxes from first column (red frame) in first range A and a text from TextBoxes from second column (green frame) in range B in new file.
I wrote the function to find a right text from dynamic TextBox, but the problem is, that the exported text is always only from TextBoxes in green frame.
Can someone explain me, how can I export text also from the TextBoxes in red frame?
Code of adding dynamic TextBox:
Code of searching text in dynamic TextBox:
I have one question about dynamic TextBox.
I wrote two different functions, which adding to MultiPage two different TextBoxes - first function adding TextBox in one column and fill up automatically with letters and numbers (red frame on picture), second function adding an empty TextBox, where I want to put my comments (green frame on picture). On MultiPage I put one TextBox for counting, how much TextBox I want to fill.
I want to have a text from TextBoxes from first column (red frame) in first range A and a text from TextBoxes from second column (green frame) in range B in new file.
I wrote the function to find a right text from dynamic TextBox, but the problem is, that the exported text is always only from TextBoxes in green frame.
Can someone explain me, how can I export text also from the TextBoxes in red frame?
Code of adding dynamic TextBox:
VBA Code:
Sub ShowNewTextBox(ByRef Window As MSForms.TextBox, Typ As Integer, Optional ByVal AddWindow As Boolean = False)
Dim DefaultText As String
Dim MinValue As Integer
Select Case Typ
Case 1
DefaultText = "K"
Case Else
DefaultText = ""
End Select
MinValue = Window.Tag + 1
Dim Ctrl As Control
Dim TopPos As Double
TopPos = Window.Top + 20 * MinValue
For i = MinValue To Window.Value
With WindowApp.Controls
If AddWindow Then
Set Ctrl = UserForm1.MultiPage1.Page1.Add("Forms.TextBox.1", Window.Name + CStr(i))
With Ctrl
.Width = 32
.Height = 16
.Top = TopPos
.Left = 6
.Value = DefaultText + CStr(10 + i)
.MaxLength = 4
.ZOrder (0)
End With
End If
If AddWindow Then
Set Ctrl = UserForm1.MultiPage1.Page1.Add("Forms.TextBox.1", Window.Name + CStr(i))
With Ctrl
.Width = 240
.Height = 16
.Top = TopPos
.Left = 44
.MaxLength = 50
.ZOrder (0)
End With
End If
TopPos = TopPos + 20
End With
Next i
End Sub
Code of searching text in dynamic TextBox:
VBA Code:
Function FindName(Iter As Integer, Name As String) As String
Dim Text As String
Dim Ctrl As Control
For Each Ctrl In UserForm1.Controls
If Ctrl.Name = Name Then
Text = Ctrl.Text
End If
Next Ctrl
FindName = Text
End Function