For i = 0 To Me.Controls.Count - 1
Set ctl = Me.Controls(i)
If TypeOf ctl Is CommandButton Then
ctl.FontSize = 10
ctl.Caption = "aa"
End If
Next
End Sub
Private Sub cmdWith_Click()
'利用with语句循环
Dim ctl As Control
Dim j As Integer
For j = 0 To Me.Controls.Count - 1
Set ctl = Me(j)
If TypeOf ctl Is CommandButton Then
With ctl
.FontSize = 9
.Caption = "bb"
End With
End If
Next
End Sub