View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Tab Order Automation??

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"
<peter.thompson.20zeoa_1136162101.0856@excelforu m-nospam.com
wrote in message
news:peter.thompson.20zeoa_1136162101.0856@excelfo rum-nospam.com...

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

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

Cheers

Peter (new to VBA)


--
peter.thompson
------------------------------------------------------------------------
peter.thompson's Profile:
http://www.excelforum.com/member.php...o&userid=29686
View this thread:
http://www.excelforum.com/showthread...hreadid=497279