Board logo

標題: [發問] 如何將Checkbox更改成OptionButton [打印本頁]

作者: av8d    時間: 2015-8-25 13:36     標題: 如何將Checkbox更改成OptionButton

  1. Dim cCBs As Integer
  2. Dim ctl As Control
  3.    cCBs = 0
  4.    For Each ctl In Me.Controls
  5.        If TypeName(ctl) = "CheckBox" Then
  6.            cCBs = cCBs + 1
  7.            ReDim Preserve aryCBs(1 To cCBs)
  8.            Set aryCBs(cCBs).CheckboxGroup = ctl
  9.        End If
  10.    Next ctl
複製代碼
  1. Option Explicit
  2. Public WithEvents CheckboxGroup As MSForms.CheckBox
  3. Private Sub CheckboxGroup_Click()
  4.     UserForm2.xlText = CheckboxGroup.Caption
  5.     UserForm3.xlText = CheckboxGroup.Caption
  6. End Sub
複製代碼
  1. Dim ctl As Control
  2.    cCBs = 0
  3.    For Each ctl In Me.Controls
  4.        If TypeName(ctl) = "CheckBox" Then
  5.            cCBs = cCBs + 1
  6.            ReDim Preserve aryCBs(1 To cCBs)
  7.            Set aryCBs(cCBs).CheckboxGroup = ctl
  8.        End If
  9.    Next ctl
複製代碼
  1. Public xlText As String
  2. Dim aryCBs() As New cControlArray
複製代碼
再次感謝各位老師們!




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)