• Protecting a section(s) (VBA Word 2000)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Protecting a section(s) (VBA Word 2000)

    Author
    Topic
    #376352

    I know how to protect a section using the Protect method, but I could not find any way to specify which sections of a multisection document you want to protect. Say I only want to protect section 1 and leave section 2 unprotected. The Protect method only seems to apply to the Document object (i.e. not the Sections collection).

    The good news is that it appears to protect whatever was protected previously if you selected the sections manually. This is a good workaround, I guess. But for future use, if I wanted to start with a document that had never been protected previously and select which section, is it possible to do that with VBA?

    Thanks!!
    Troy

    Viewing 0 reply threads
    Author
    Replies
    • #616076

      Troy, I only have W97 here, and it only protects forms on a section by section basis, so
      ActiveDocument.Sections(2).ProtectedForForms = True
      is OK.

      Can you protect a single section of a W2k document with the menus?
      –Sam

      • #616200

        That method would work, except I need to be able to NOT reset field values and to specify a password. Both of those options are available with the Protect method, but neither seem to be available for the property you mentioned.

        Any other ideas?

        Thanks!!
        Troy

        • #616275

          I just tested this on Word 2000 by creating a simple document with two sections and a formfield in the second section.

          I issued the commands

          ActiveDocument.Sections(1).ProtectedForForms = False
          ActiveDocument.Sections(2).ProtectedForForms = True
          

          At this point the document is NOT protected for forms. I have just told Word which sections should be protected later
          Then I typed

          ActiveDocument.Protect type:=wdAllowOnlyFormFields 
          

          and now the second section was protected but the first one still allowed me to edit whatever I wanted.

          StuartR

    Viewing 0 reply threads
    Reply To: Protecting a section(s) (VBA Word 2000)

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

    Your information: