Help with Macro/VB

J

J_a_y_100

Hello Guys, I am running here and there for help on this. I am not
familiar with the programming aspect. I am in quality engineering
field. I would appreciate your help.

I have made a Customer Satisfaction Survey form in Words. There are 4
questions and customer can choose Excellence, Very Good, Good and Poor
for each of 4 questions. I have designed a drop down list for above
choices. Now I want to assign a number for each choice, so that I can
get % Customer Satisfaction Score. For example, if customer chooses
'Excellence', then there will be a number of 4, 'Very Good' is 3 and
so on. At the end I want to calculate the % score. How to accomplish
this? Please help me.

Thanks,

Jay
 
D

Doug Robbins - Word MVP

What type of form? If it is one in a protected document, the following
command will return a number that corresponds to the position of the
selected item in the list of items in a Dropdown type formfield:

ActiveDocument.FormFields("Dropdown1").DropDown.Value

If your list was

Poor
Good
Very Good
Excellent

the choice of Poor would return 1 and Excellent would return 4 with the use
of the above.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

J_a_y_100

What type of form? If it is one in a protected document, the following
command will return a number that corresponds to the position of the
selected item in the list of items in a Dropdown type formfield:

ActiveDocument.FormFields("Dropdown1").DropDown.Value

If your list was

Poor
Good
Very Good
Excellent

the choice of Poor would return 1 and Excellent would return 4 with the use
of the above.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP







- Show quoted text -

Hello Doug, First I would like to thank you for your reply.
I have saved the form as a template. I have written this code on
Visual Basic Editor

"Public Sub Score1()
Dim Dropdown1 As String
Dim Text11 As String
If Dropdown1 = "Excellence" Then
Text11.Text = "4"

End If

End Sub"
In Dropdown1 property, I have added above code on exit event of
Dropdown1 text box. Text11 is the corresponding text box for showing
the number. But it does not work.
Thanks,
 
D

Doug Robbins - Word MVP

Your code is nothing like that which I suggested.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

J_a_y_100

Your code is nothing like that which I suggested.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP










- Show quoted text -
Doug, I have modified the codes based on someone's advice and written
following:

Sub Score()
Dim iTotal As Integer

If ActiveDocument.FormFields("Tex11l").Result = "" Then
iTotal = iTotal +
ActiveDocument.FormFields("Dropdown1").DropDown.Value
iTotal = iTotal +
ActiveDocument.FormFields("Dropdown2").DropDown.Value
iTotal = iTotal +
ActiveDocument.FormFields("Dropdown3").DropDown.Value
iTotal = iTotal +
ActiveDocument.FormFields("Dropdown4").DropDown.Value
iTotal = (iTotal / 16) * 100
ActiveDocument.FormFields("Text11").Result = Str(iTotal)
End If

End Sub
On Dropdown4, I have used above macro and tick mark calculate on exit.
But when I want to use the Survey and want to exit from last drodown
menu, message comes that "macro are disabled for this project..."
I do not know what to do. I would appreciate your help very much
 
D

Doug Robbins - Word MVP

With ActiveDocument
If =.FormFields("Tex11").Result = "" Then
.FormFields("Text11").Result =
(.FormFields("Dropdown1").DropDown.Value _
+ .FormFields("Dropdown2").DropDown.Value _
+ .FormFields("Dropdown3").DropDown.Value _
+ .FormFields("Dropdown4").DropDown.Value) / 16 * 100
End If
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top