PDA

View Full Version : Help with selections



timmyjane
06-21-2011, 07:17 PM
I am relatively new to coding. Our machines are using Word 2003. I have created a document that has two sections using continious page break. I have a command button that would select the first section only if a drop down box said "does not apply" and would include sections 1 and 2 if the box said "applies". From there it would paste into notepad for uploading.

Now the rules have changed for the document and many of the sentences are optional for inclusion that were previously not optional. What I would like to do is include these lines in the final selection if the drop down said "applies" and not include them if otherwise. If the dropdown had applies there is a form field that would have to be included after it as an explination.

I have been using range select but I dont see how it would work in this situation because there is no telling what combination of dropdowns would say applies.

For example:

I bought a fruit basket. The fruit basket contained the following.

Apples-Applies. There were 5 appples.
Banannas-Does not apply.
Oranges-Does not apply.
Grapes-Applies. There were two bunches of grapes.

Final product:

I bought a fruit basket. The basket contained the following.
There were 5 apples.
There were two bunches of grapes.

Make sense? Thanks for any help.

macropod
06-24-2011, 04:39 AM
Hi timmyjane,

If the 'Sections' are true Word Sections, you could simply delete the unwanted ones. You don't need to select anything - simply use:
ActiveDocument.Sections(#).Range.Delete
where # is the number of the Section concerned.