|
FuserFormにFrame1〜3を配し、各FrameのCaptionを「問1」、「問2」、「問3」とします
各Frameの中に、「Yes」、「No」のCaptionを持つ2つのOptionButtonを配置します
UserFormの適当な位置にLabel1を配置します
Option Explicit
Private Sub OptionButton1_Click()
GetAnswer OptionButton1
End Sub
Private Sub OptionButton2_Click()
GetAnswer OptionButton2
End Sub
Private Sub OptionButton3_Click()
GetAnswer OptionButton3
End Sub
Private Sub OptionButton4_Click()
GetAnswer OptionButton4
End Sub
Private Sub OptionButton5_Click()
GetAnswer OptionButton5
End Sub
Private Sub OptionButton6_Click()
GetAnswer OptionButton6
End Sub
Private Sub GetAnswer(cntOption As MSForms.OptionButton)
Dim i As Long
Dim strResult As String
With cntOption
.Parent.Tag = .Caption
End With
For i = 0 To Controls.Count - 1
If TypeName(Controls(i)) = "Frame" Then
If StrComp(Controls(i).Tag, "Yes", vbTextCompare) = 0 Then
If strResult <> "" Then
strResult = strResult & ","
End If
strResult = strResult & Controls(i).Caption
End If
End If
Next i
Label1.Caption = strResult
End Sub
|
|