Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2007

Tip: Looking for answers? Try searching our database.

Help with Macro/VB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
J_a_y_100@lycos.com - 27 Mar 2007 03:33 GMT
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
Doug Robbins - Word MVP - 27 Mar 2007 04:34 GMT
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.

Signature

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

> 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
[quoted text clipped - 12 lines]
>
> Jay
J_a_y_100@lycos.com - 28 Mar 2007 03:00 GMT
On Mar 26, 10:34 pm, "Doug Robbins - Word MVP"
<d...@REMOVECAPSmvps.org> wrote:
> 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
[quoted text clipped - 42 lines]
>
> - 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,
Doug Robbins - Word MVP - 28 Mar 2007 16:10 GMT
Your code is nothing like that which I suggested.

Signature

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

> On Mar 26, 10:34 pm, "Doug Robbins - Word MVP"
> <d...@REMOVECAPSmvps.org> wrote:
[quoted text clipped - 63 lines]
> the number. But it does not work.
> Thanks,
J_a_y_100@lycos.com - 29 Mar 2007 03:51 GMT
On Mar 28, 10:10 am, "Doug Robbins - Word MVP"
<d...@REMOVECAPSmvps.org> wrote:
> Your code is nothing like that which I suggested.
>
[quoted text clipped - 79 lines]
>
> - 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
Doug Robbins - Word MVP - 29 Mar 2007 21:14 GMT
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

Signature

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

> On Mar 28, 10:10 am, "Doug Robbins - Word MVP"
> <d...@REMOVECAPSmvps.org> wrote:
[quoted text clipped - 110 lines]
> menu, message comes that "macro are disabled for this project..."
> I do not know what to do. I would appreciate your help very much
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.