• Reading Controls from a Word Doc (Office 2000 SR-1)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Reading Controls from a Word Doc (Office 2000 SR-1)

    Author
    Topic
    #381581

    I have a Word document, with several fields on the page, including a text form field. When the user exits the field, I want to read the value in VBA code. I can run a macro on exit, but what is the correct syntax for reading the user entered value from the text field?
    Thank you

    Viewing 0 reply threads
    Author
    Replies
    • #643740

      To get the text entered by the user, you need to know the name or number of the form field. The name is that of the bookmark associated with the form field – if you double click the form field while the document is unprotected, you will see this name. Instead of the name, you can also use the index – 1 for the first form field, 2 for the second, etc.

      For a form field whose bookmark is named “TextField”, use ActiveDocument.FormFields(“TextField”).Result to get the text.

    Viewing 0 reply threads
    Reply To: Reading Controls from a Word Doc (Office 2000 SR-1)

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

    Your information: