View Single Post
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
CulinaryDisaster CulinaryDisaster is offline
external usenet poster
 
Posts: 2
Default Macro for deleting multiple sections of a form.

I have a protected form which consists of 13 sections (20 pages in length).
Dependent upon the user's needs, he will only need to fill out 2 or 3
sections. My goal is to write a macro that will unprotect, delete the
unnecessary sections, and save it as a new file. There will be 12 macros
(one for each possible combination)which will reside on a special tool bar in
the document. I've done parts of all of this but have yet to link them
together in a single macro.

My experience in writing macros in VBA is close to non-existent. However, I
do copy, paste and edit with some proficiency. I have copied the
unprotect/protect macro from other posts. I found the following macro to
work when deleting a specific single section:

ActiveDocument.Sections(1).Range.Delete

How do I delete multiple sections - particularly if they are not sequencial
(i.e. Delete sections 2, 3, 5 through 10, 12 and 13)?