D
dworst
I've got the following code and I want the result to be formatted as
follows:
0.0%
I've looked for samples of how to do this but I'm a bit confused. Can
someone help me out with how to do it? Thanks in advance!
Public Sub Eval()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim intWait As Integer
StatusBar = "Please wait..."
For intWait = 1 To 1000
System.Cursor = wdCursorWait
Next intWait
Dim a, b, c, d, e, f, g, h, i, j, k As Double
Dim pScore As Double
Dim vdenominator As Integer
vdenominator = 11
With ThisDocument
Select Case True 'Adaptability
Case .OptionButton1.Value
a = 1
Case .OptionButton11.Value
a = 2
Case .OptionButton12.Value
a = 3
Case .OptionButton13.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Adaptability"
Exit Sub
End Select
Select Case True 'Acumen
Case .OptionButton2.Value
b = 1
Case .OptionButton21.Value
b = 2
Case .OptionButton22.Value
b = 3
Case .OptionButton23.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Business Acumen"
Exit Sub
End Select
Select Case True 'BusinessCollaboration
Case .OptionButton3.Value
c = 1
Case .OptionButton31.Value
c = 2
Case .OptionButton32.Value
c = 3
Case .OptionButton33.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Business Collaboration"
Exit Sub
End Select
Select Case True 'TeamCollaboration
Case .OptionButton7.Value
k = 1
Case .OptionButton8.Value
k = 2
Case .OptionButton9.Value
k = 3
Case .OptionButton10.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Team Collaboration"
Exit Sub
End Select
Select Case True 'Communication
Case .OptionButton4.Value
d = 1
Case .OptionButton41.Value
d = 2
Case .OptionButton42.Value
d = 3
Case .OptionButton43.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Communication"
Exit Sub
End Select
Select Case True 'Customer Focus"
Case .OptionButton5.Value
e = 1
Case .OptionButton51.Value
e = 2
Case .OptionButton52.Value
e = 3
Case .OptionButton53.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Customer Focus"
Exit Sub
End Select
Select Case True 'Knowledge Application
Case .OptionButton6.Value
f = 1
Case .OptionButton61.Value
f = 2
Case .OptionButton62.Value
f = 3
Case .OptionButton63.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Knowledge Application"
Exit Sub
End Select
Select Case True 'Leadership
Case .OptionButton64.Value
g = 1
Case .OptionButton641.Value
g = 2
Case .OptionButton642.Value
g = 3
Case .OptionButton643.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Leadership"
Exit Sub
End Select
Select Case True 'People Development
Case .OptionButton644.Value
h = 1
Case .OptionButton6441.Value
h = 2
Case .OptionButton6442.Value
h = 3
Case .OptionButton6443.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in People Development"
Exit Sub
End Select
Select Case True 'Project Participation
Case .OptionButton6444.Value
i = 1
Case .OptionButton64441.Value
i = 2
Case .OptionButton64442.Value
i = 3
Case .OptionButton64443.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Technical Expertise"
Exit Sub
End Select
Select Case True 'Technical Expertise
Case .OptionButton64444.Value
j = 1
Case .OptionButton644441.Value
j = 2
Case .OptionButton644442.Value
j = 3
Case .OptionButton644443.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Technical Expertise"
Exit Sub
End Select
pScore = (a + b + c + d + e + f + g + h + i + j + k) / vdenominator
MsgBox "Average score = " & pScore
End With
With ActiveDocument
.Unprotect
.FormFields("Total_Score").Result = pScore
.Protect wdAllowOnlyFormFields, True
End With
End Sub
follows:
0.0%
I've looked for samples of how to do this but I'm a bit confused. Can
someone help me out with how to do it? Thanks in advance!
Public Sub Eval()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim intWait As Integer
StatusBar = "Please wait..."
For intWait = 1 To 1000
System.Cursor = wdCursorWait
Next intWait
Dim a, b, c, d, e, f, g, h, i, j, k As Double
Dim pScore As Double
Dim vdenominator As Integer
vdenominator = 11
With ThisDocument
Select Case True 'Adaptability
Case .OptionButton1.Value
a = 1
Case .OptionButton11.Value
a = 2
Case .OptionButton12.Value
a = 3
Case .OptionButton13.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Adaptability"
Exit Sub
End Select
Select Case True 'Acumen
Case .OptionButton2.Value
b = 1
Case .OptionButton21.Value
b = 2
Case .OptionButton22.Value
b = 3
Case .OptionButton23.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Business Acumen"
Exit Sub
End Select
Select Case True 'BusinessCollaboration
Case .OptionButton3.Value
c = 1
Case .OptionButton31.Value
c = 2
Case .OptionButton32.Value
c = 3
Case .OptionButton33.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Business Collaboration"
Exit Sub
End Select
Select Case True 'TeamCollaboration
Case .OptionButton7.Value
k = 1
Case .OptionButton8.Value
k = 2
Case .OptionButton9.Value
k = 3
Case .OptionButton10.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Team Collaboration"
Exit Sub
End Select
Select Case True 'Communication
Case .OptionButton4.Value
d = 1
Case .OptionButton41.Value
d = 2
Case .OptionButton42.Value
d = 3
Case .OptionButton43.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Communication"
Exit Sub
End Select
Select Case True 'Customer Focus"
Case .OptionButton5.Value
e = 1
Case .OptionButton51.Value
e = 2
Case .OptionButton52.Value
e = 3
Case .OptionButton53.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Customer Focus"
Exit Sub
End Select
Select Case True 'Knowledge Application
Case .OptionButton6.Value
f = 1
Case .OptionButton61.Value
f = 2
Case .OptionButton62.Value
f = 3
Case .OptionButton63.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Knowledge Application"
Exit Sub
End Select
Select Case True 'Leadership
Case .OptionButton64.Value
g = 1
Case .OptionButton641.Value
g = 2
Case .OptionButton642.Value
g = 3
Case .OptionButton643.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Leadership"
Exit Sub
End Select
Select Case True 'People Development
Case .OptionButton644.Value
h = 1
Case .OptionButton6441.Value
h = 2
Case .OptionButton6442.Value
h = 3
Case .OptionButton6443.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in People Development"
Exit Sub
End Select
Select Case True 'Project Participation
Case .OptionButton6444.Value
i = 1
Case .OptionButton64441.Value
i = 2
Case .OptionButton64442.Value
i = 3
Case .OptionButton64443.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Technical Expertise"
Exit Sub
End Select
Select Case True 'Technical Expertise
Case .OptionButton64444.Value
j = 1
Case .OptionButton644441.Value
j = 2
Case .OptionButton644442.Value
j = 3
Case .OptionButton644443.Value
vdenominator = vdenominator - 1
Case Else
MsgBox "No selection in Technical Expertise"
Exit Sub
End Select
pScore = (a + b + c + d + e + f + g + h + i + j + k) / vdenominator
MsgBox "Average score = " & pScore
End With
With ActiveDocument
.Unprotect
.FormFields("Total_Score").Result = pScore
.Protect wdAllowOnlyFormFields, True
End With
End Sub