Results 1 to 9 of 9
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA in Word Form (Word 2003)

    I don't see any code in the document you attached...

  2. #2
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Idaho, USA
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA in Word Form (Word 2003)

    Attempting to get a VBA script to run in a word form that adds text in a text field based on a choice in a drop down menu. I've attached the dot for you to reference. The script might add the text for exemplary but doesn't recognize solidsustained or achieve or doesn't achieve. What's missing in the code?
    Couldn't attach code so placing in this post.
    Sub Customer_Service_Rating()
    '
    ' Customer_Service_Rating Macro
    ' Macro recorded 8/23/2006 by corders
    '
    If (lstDropDown1 = Exemplary) Then
    Selection.GoTo Text102
    Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend
    Selection.TypeText Text:= _
    "You expertly handle difficult customer inquiries, questions, and complaints. You anticipate problems and take action to prevent them from escalating; consistently act on requests; provide solutions in a timely fashion; and follow through on customer requests. You make efforts to get customer feedback, and you consistently include customer perspective in your decision making. You are consistently clear, courteous, responsive, and professional in your communications with customers."
    Selection.GoTo (CSAddComment)
    Else
    If (lstDropDown1 = SolidSustained) Then
    Selection.GoTo Text102
    Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend
    Selection.TypeText Text:= _
    "You are able to thoroughly address most customer inquiries, questions, complaints. You routinely act on requests and provide solutions in a timely fashion by following through on customer requests. You routinely consider customer feedback and perspective in your decision making. You are clear and courteous in your communications with customers."
    Selection.GoTo (CSAddComment)
    Else
    If (lstDropDown1 = Achieves) Then
    Selection.GoTo Text102
    Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend
    Selection.TypeText Text:= _
    "You are able to address routine customer inquiries, questions, complaints. You usually act on requests and provide solutions in a timely fashion. You consider customer feedback and perspective in your decision making. You are usually clear and courteous in your communications with customers."
    Selection.GoTo (CSAddComment)
    Else
    If (lstDropDown1 = DoesNotAchieve) Then
    Selection.GoTo Text102
    Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend
    Selection.TypeText Text:= _
    "You are not consistently able to address routine customer inquires, questions, and complaints, and you require ongoing assistance by management or your peers. You are inconsistent in acting on requests and/or providing solutions in a timely manner. You are inconsistent in considering customer feedback and perspective in your decision making. You are inconsistent in clarity and courtesy in your communications with customers."
    Selection.GoTo (CSAddComment)
    End If
    End If
    End If
    End If


    End Sub

    Thanks...

  3. #3
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Idaho, USA
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA in Word Form (Word 2003)

    just added to the post---sorry

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA in Word Form (Word 2003)

    What is lstDropDown1? It's not the name of the dropdown from the Forms toolbar in your document.

  5. #5
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Idaho, USA
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA in Word Form (Word 2003)

    May not have come over in the posted doc. In the original dot, the text form field is bookmarked as dropdown1. 1st indicates the location or position of the text in the drop down field--exemplary, solidsustain, etc. Can the macro identify the text and then add the supplemental text?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA in Word Form (Word 2003)

    Yes, your document contains a dropdown Dropdown1, but your code refers to something calles lstDropDown1 (LSTDROPDOWN1, not 1ST DROPDOWN or something like that) - I don't know what that is.

  7. #7
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Idaho, USA
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA in Word Form (Word 2003)

    so how do I get the macro to recognize my choice from the drop down and place the related text in the text field below the drop down?

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA in Word Form (Word 2003)

    See the attached document. I placed all form fields in a protected section (and removed the rest of the document for simplicity). One of the important points is that names are strings that must be surrounded with quotes. If you use a name without quotes, VBA thinks it is a VBA variable. And the macro must be executed when the user exits the dropdown, not when the user enters it (the user hasn't changed the selection then).

  9. #9
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Idaho, USA
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA in Word Form (Word 2003)

    Making your changes now and testing. Thank you...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •