Hi Ken
ActiveX Textboxes are not part of a textbox collection, so no, that is
impossible. A common workaround is to loop all controls and it this one
control is a textbox then do something. Or use those from the Forms toolbar.
Or:
Here's a really cool trick: You can create your own collections with VB /
VBA. You don't say where your boxes are, but if they're on a userform then
use this code for it:
Option Explicit ' top of module
Dim TBoxes As New Collection
Private Sub UserForm_Initialize()
TBoxes.Add Me.TextBox1
TBoxes.Add Me.TextBox2
TBoxes.Add Me.TextBox3
TBoxes.Add Me.TextBox4
'and so on
End Sub
'and our demo loop, here assigned to a button :
Private Sub CommandButton1_Click()
Dim L As Long
For L = 1 To TBoxes.Count
TBoxes(L).Text = "TBox " & L & " says Hello World"
Next
End Sub
'end of code
Collections are, in theory, memory hungry, but on a modern computer that
won't cause noticable problems. They are very flexible and blistering fast.
HTH. Best wishes Harald