vba checkbox运用

来源:百度知道 编辑:UC知道 时间:2024/06/06 16:51:04
我要做个程序,需要通过判断是否选中来取出checkbox的caption值,希望大虾指点下~~~~~~~~~~~~~
从多个CHECKBOX中取、
我会写if checkbox1.value=true then textbox1.text=checkbox1.caption
然后多个中选就~~~~~~~~~~~~~~~~

建立checkbox1数组,然后循环判断
If Check1(0).Value = 1 Then
textbox1.text=checkbox1(0).caption
ElseIf Check1(1).Value = 1 Then
textbox1.text=checkbox1(1).caption
ElseIf Check1(2).Value = 1 Then
textbox1.text=checkbox1(2).caption
ElseIf Check1(3).Value = 1 Then
textbox1.text=checkbox1(3).caption
End If

Private Sub Command1_Click()
textbox1.Text = ""
If Check1(0).Value = 1 Then textbox1.Text = textbox1.Text & checkbox1(0).Caption
If Check1(1).Value = 1 Then textbox1.Text = textbox1.Text & checkbox1(1).Caption
If Check1(2).Value = 1 Then textbox1.Text = textbox1.Text & checkbox1(2).Caption
If Check1(3).Value = 1 Then textbox1.Text = textbox1.Text & checkbox1(3).Caption
End Sub
选中几个checkbox就在textbox1中显示几个Caption