Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically forming an object name

Tags:

vba

Suppose I have a few TextBoxes in a VBA form, called Text1,Text2,Text3. I'm looking for a way to do something like:

For i = 1 To 4 
 (Text&i).Text=i
Next 

This is just a very simple example of what I want to do. I want to be able to form an object name programatically on run-time and then do something with the object. In this simple case I want Text1.Text=1, Text2.Text=2,Text3.Text=3.

Is there any way to do something like this?

like image 504
leonsas Avatar asked Apr 22 '26 14:04

leonsas


1 Answers

Me.Controls("Text" & i).Text
like image 60
GSerg Avatar answered Apr 24 '26 11:04

GSerg