我有个问题:
我需要创建一个包含通常的确定和取消按钮的用户表单。它还应该包含两组选项按钮,每组都放置在一个框架内。第一组的字幕应该是篮球、棒球、足球,第二组的字幕应该是看电视和去比赛。我需要在模块中编写事件处理程序和代码,以便在程序运行时,用户可以看到表单。如果用户做出几个选择并单击“确定”,他应该会看到一条消息,例如“您最喜欢的运动是篮球,您通常在电视上观看”。如果用户单击“取消”,则应出现“抱歉,您不想玩”消息。
我想我几乎让它工作了,但我不知道为什么我不能成功执行宏。
我的代码是:
Option Explicit
Private Sub CommandButton2_Click()
MsgBox ("sorry if you don't want to play")
End Sub
Private Sub commandbuttons_Click()
Dim optbasket As String, optbaseball As String, optfootball As String
Dim optwog As String, optgtg As String
Select Case True
Case optbasket
optbasket = True
Case optbaseball
optbaseball = True
Case optfootball
optfootball = True
End Select
If optwog Then
optwog = True
Else
optgtg = True
End If
btnok = MsgBox("you favorite sport is " & Frame1.Value & "you usually " & Frame2.Value & ",")
End Sub
Private Sub OptionButton1_Click()
End Sub
Private Sub btmcancel_Click()
End Sub
Private Sub btnok_Click()
End Sub
Private Sub Frame1_Click()
End Sub
Private Sub Frame2_Click()
End Sub
Private Sub optbaseball_Click()
End Sub
Private Sub optbasketball_Click()
End Sub
Private Sub optfootball_Click()
End Sub
非常感谢!!!