• VBA in Word Form (Word 2003)

    Author
    Topic
    #434934

    I don’t see any code in the document you attached…

    Viewing 1 reply thread
    Author
    Replies
    • #1026643

      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…

      • #1026645

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

        • #1026731

          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?

          • #1026734

            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.

            • #1026736

              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?

            • #1026742

              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).

            • #1026750

              Making your changes now and testing. Thank you…

    • #1026644

      just added to the post—sorry

    Viewing 1 reply thread
    Reply To: VBA in Word Form (Word 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: