Results 1 to 4 of 4
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I determine if a Form (Word 2002 /XP SP3)

    I need to write some condition code if the current document is a Form.

    The form can be protected. not with a passwor. ie Goto the Word menu> Tools>Protect Document...Forms>Ok.
    Or the forms can be unprotected.

    Is there a way to determine if the current document is a Word form? Do I just test to see if the document contains a Text Form Field?

    Many thanks

    diana

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: How do I determine if a Form (Word 2002 /XP SP3)

    Hi Diana,

    You could use:
    If ActiveDocument.FormFields.Count > 0 Then ...
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: How do I determine if a Form (Word 2002 /XP SP3)

    Hi Diana,

    My previous reply only dealt with the standard formfields. If any ActiveX Userforms are loaded, you can test for those with:
    If UserForms.Count>0 Then ...
    Cheers,

    Paul Edstein
    [MS MVP - Word]

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

    Re: How do I determine if a Form (Word 2002 /XP SP3)

    You can use something like

    If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
    MsgBox "The document is protected for forms", vbInformation
    Else
    MsgBox "The document is not protected for forms", vbInformation
    End If

Posting Permissions

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