Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Slough, Berkshire, England
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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

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

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

    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.

  3. #3
    Lounger
    Join Date
    Jan 2001
    Location
    Slough, Berkshire, England
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    Thank you, that works perfectly

Posting Permissions

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