|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
答题卡是在窗体中,选项按钮不是InlineShape。可试作如下相应改动:- Private Sub CommandButton1_Click()
- Dim result()
- Dim dann
- Dim aControl As Control
- Dim msg As String, ans As String
- Dim i As Integer, r As Integer, y As Integer, f As Integer
- Dim w As Integer
- dann = Array("A", "B", "C", "D", "A")
- ReDim result(UBound(dann))
- i = 0
- For Each aControl In Controls
- With aControl
- If .Name Like "OptionButton*" Then
- f = f + 1
- If .Object.Value = True Then
- result(i) = Trim(.Object.Caption)
- i = i + 1
- End If
- If Int(f / 4) > i Then
- result(i) = "无作答"
- i = i + 1
- End If
- End If
- End With
- Next
- '....
复制代码 |
|