Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Hayfa Khan   on Aug 10 In MS Office Category.

  
Question Answered By: Cain Smith   on Aug 10

And this is what I tried to do with the UserForm.

Sub OnlyFrames()

Application.ScreenUpdating = False
Sheets("Sheet1").Select
Sheets("Sheet1").Range("A1:F500") = ""
LoopInd = 0
lcount = 0
tabIdx = 0
Set myForm = UserForm10
Cells(2, 3) = "OBJECT NAME="
Cells(2, 4) = "TAB INDEX="
Cells(2, 5) = "TAB STOP="
Cells(2, 6) = "OPTBUTTON="
Cells(3, 3) = "UserForm10"

lcount = 3
LoopInd = LoopInd + 1
For Each cCont In myForm.Controls
If LoopInd > 1 Then Exit For
tabIdx = tabIdx + 1
lcount = lcount + 1
Cells(lcount, 3) = cCont.Name
'MsgBox ("TYPENAME: " & TypeName(cCont))
If TypeName(cCont) = "Frame" Then
Cells(lcount, 3).Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 5
End With
Else
Cells(lcount, 3).Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
End If
If TypeName(cCont) = "CommandButton" Then
Cells(lcount, 5) = cCont.TabStop
cCont.TabStop = False
cCont.TabIndex = tabIdx
Else
Cells(lcount, 5) = ""
End If
If TypeName(cCont) = "OptionButton" Then
Cells(lcount, 6) = cCont.Value
cCont.Value = False
cCont.TabIndex = tabIdx
Else
Cells(lcount, 6) = ""
End If
If TypeName(cCont) <> "Label" Then
Cells(lcount, 5) = cCont.TabStop
cCont.TabStop = True
cCont.TabIndex = tabIdx
Else
Cells(lcount, 5) = ""
End If
Cells(lcount, 4) = cCont.TabIndex
Next cCont
SendKeys "^{Home}"
Range("A1").Select

End Sub

Share: 

 

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

 
Didn't find what you were looking for? Find more on How to prevent (TabKey) going to a command button ? Or get search suggestion and latest updates.


Tagged: