J
jgeorgen
I am building an evaluation form for work. There are seven
categories. In each category there are five ratings (1-5) and users
select a rating by clicking an option button. I'd like to calculate
the numeric total of all the selected option buttons at the bottom of
the form and I've tried to use the following code to do so:
Dim a, b, c, d, e, f, g As Long
Dim pScore As Long
With ThisDocument
Select Case True 'First group
Case .OptionButton1.Value
a = 5
Case .OptionButton2.Value
a = 4
Case .OptionButton3.Value
a = 3
Case .OptionButton4.Value
a = 2
Case .OptionButton5.Value
a = 1
Case Else
MsgBox "No selection in Group 1"
End Select
'this would be repeated for the other categories.
End With
End Sub
When finally running the code, however, I get the following error
msg... "Compile Error: Method or Data Member not found" and the
program highlights the words "OptionButton1" in the code. Can someone
help me understand what this means and how to fix it? Thanks very
much.
categories. In each category there are five ratings (1-5) and users
select a rating by clicking an option button. I'd like to calculate
the numeric total of all the selected option buttons at the bottom of
the form and I've tried to use the following code to do so:
Dim a, b, c, d, e, f, g As Long
Dim pScore As Long
With ThisDocument
Select Case True 'First group
Case .OptionButton1.Value
a = 5
Case .OptionButton2.Value
a = 4
Case .OptionButton3.Value
a = 3
Case .OptionButton4.Value
a = 2
Case .OptionButton5.Value
a = 1
Case Else
MsgBox "No selection in Group 1"
End Select
'this would be repeated for the other categories.
End With
End Sub
When finally running the code, however, I get the following error
msg... "Compile Error: Method or Data Member not found" and the
program highlights the words "OptionButton1" in the code. Can someone
help me understand what this means and how to fix it? Thanks very
much.