Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Jamil Akram   on Sep 08 In MS Office Category.

  
Question Answered By: Amelia Schmidt   on Sep 08

No, what you are looking for here is called self modifying code. It
is possible in some computer languages but not VBA. It has something
to do with VBA being a just-in-time compiled language that compiles at
the sub/function level. If it was a JIT compile at the statement
level it could do what you are looking for.

But, there is a way to work  with your textbox properties in a loop:

Private Sub CommandButton1_Click()
Dim ctrl As Variant
Dim i1 As Integer
Dim a1(20) As String
i1 = 1
For Each ctrl In UserForm1.Controls
If InStr(ctrl.Name, "TextBox") > 0 Then
a1(i1) = ctrl.Value
i1 = i1 + 1
End If
Next
End Sub

This code snippit uses a loop to store the values of your userfrom
into an array.

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on many textboxes Or get search suggestion and latest updates.


Tagged: