请试改进和规范下面例程。
Sub FlipEnable(pctl As control, pfrm As Form, pstrScope As String)
Dim ctlEach As control
For Each ctlEach In pfrm.Controls
If TypeName(ctlEach) = TypeName(pctl) Then '是否同一类
If pstrScope = "All" Then
ctlEach.Enabled = Not ctlEach.Enabled
If TypeName(ctlEach) <> "CommandButton" Then
ctlEach.Locked = Not ctlEach.Locked
End If
ElseIf pstrScope = "Except" Then
If ctlEach.name <> pctl.name Then '是否为参数对象
ctlEach.Enabled = Not ctlEach.Enabled
If TypeName(ctlEach) <> "CommandButton" Then
ctlEach.Locked = Not ctlEach.Locked
End If
End If
End If
End If
Next
End Sub
http://www.officefans.net/cdb/viewthread.php?tid=7976&page=1&sid=bca4e046269849253c60f150ab100f3d#pid19110
[此贴子已经被作者于2003-4-3 16:21:17编辑过]
|