Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Sep 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word 2000 code to Word 97 (form fields) (Word 97)

    I have created several templates using Word 2000 which have a number of drop down form fields, text form fields and check boxes with associated code. I have been asked if I can have the templates work with Word 97.

    I have tested the templates with Word 97 and the code that checks the drop down form fields fails. My Word 97 help has very little about form fields. Would I have to make major changes to the template the have the code work?

    The code that is causing problems at the moment is line 2 below
    Name = Selection.Bookmarks(1).Name
    If ActiveDocument.FormFields(Name).Result = "Select Title" Then

    Any suggestions appreciated as I am no expert at this.

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

    Re: Word 2000 code to Word 97 (form fields) (Word 97)

    Using Name as variable is not a good idea, since Name is also a property of many objects. See if it helps if you change the variable to strName or something like that.

    If not, could you attach a stripped down copy of one of the templates? Remove sensitive information.

  3. #3
    Star Lounger
    Join Date
    Sep 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word 2000 code to Word 97 (form fields) (Word 97)

    Thanks Hans

    I changed the variable name but it did not make any difference.
    I have attached the template document with only the code that is causing a problem. The template has two drop down boxes. I want to ensure that the user chooses one of the items and also that the two boxes do not contain the same item. The template would be protected when in use.
    Attached Files Attached Files

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

    Re: Word 2000 code to Word 97 (form fields) (Word 97)

    The document you attached has been protected with a password, so it is not possible to experiment with the design. (BTW, I don't have Word 97 any more, so someone else will have to test it)

  5. #5
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word 2000 code to Word 97 (form fields) (Word 97)

    Hi Rob,

    I tested your code in Word 97. If you use Dim Name As String, then there's an error stating that the member of the collection not exists. If you change that to Dim Name As Variant, then the code should cause no error.
    I also checked it in In Word 2003; in that version using Name as String works without error.

  6. #6
    Star Lounger
    Join Date
    Sep 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word 2000 code to Word 97 (form fields) (Word 97)

    Thank you very much Jan, that has solved my problem, the templates work in Word 97 and 2000.

Posting Permissions

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