Tab Order Automation??

  • Thread starter Thread starter peter.thompson
  • Start date Start date
P

peter.thompson

I have many userforms with several textboxes which require the same 'ta
order' settings.

Is there a way to automate this process for all of the commo
userforms? Or can the tab order be copied from one form to another?

Cheers

Peter (new to VBA
 
Assuming that the textboxes all have the same name in each form,
use code like the following:

Dim Ctrl As MSForms.Control
Dim VBComp As VBIDE.VBComponent
For Each VBComp In ThisWorkbook.VBProject.VBComponents
If VBComp.Type = vbext_ct_MSForm Then
For Each Ctrl In ThisWorkbook.VBProject. _
VBComponents("Userform1").Designer.Controls
If TypeOf Ctrl Is MSForms.TextBox Then
VBComp.Designer.Controls(Ctrl.Name).TabIndex =
Ctrl.TabIndex
End If
Next Ctrl
End If
Next VBComp


You'll need to set a reference to the Extensibility library. In
VBA, go to the Tools menu, choose References, and scroll down to
and check "Microsoft Visual Basic For Applications
Extensibilitity Library".


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"peter.thompson"
<[email protected]>
wrote in message
news:p[email protected]...
 
I should have added that the tab order will be set in all forms
to match the tab order of UserForm1. Change "UserForm1" to the
form whose tab order you want to copy.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top