frank112
Sun Mar 02 21:52:00 PST 2008
The ansver to your question is, no it only includes the content until it hits
the next heading with a style number 1 or 2. But that can be defined
dependently on the level you describe in the code.
"fumei via OfficeKB.com" wrote:
> Jean-Guy is right. Use Range. However, the BIG question is:
>
> 1. General
> This is general.
> 1.1 Cars
> Here you can find cars.
> 1.2 Houses
> Here you cand find houses.
> 2. Theory
> This is theory.
>
> So if I have a nice script it creates 4 files:
> general.doc, cars.doc, houses.doc and theory.doc.
>
> OK. But does general.doc INCLUDE Cars.doc and Houses.doc.?
>
> In other words:
>
> Doc_A (General) = 1. General
> This is general.
> 1.1 Cars
> Here you can find cars.
> 1.2 Houses
> Here you cand find houses.
>
> Doc_B (Cars) =
> 1.1 Cars
> Here you can find cars.
>
> Doc_C (Houses) =
> 1.2 Houses
> Here you cand find houses.
>
> Doc_D (Theory) =
> 2. Theory
> This is theory.
>
> Or do you really want to separate it, like:
>
> Doc_A (General) = 1. General
> This is general.
>
> Doc_B (Cars) =
> 1.1 Cars
> Here you can find cars.
>
> Doc_C (Houses) =
> 1.2 Houses
> Here you cand find houses.
>
> Doc_D (Theory) =
> 2. Theory
> This is theory.
>
> This is a logic specification, and must be settled. Both could be done using
> the general suggestions Jean-Guy made...but you have to decide.
>
> Jean-Guy Marcil wrote:
> >> Thank you very much for this peace of code even though I wasn't the one
> >> asking the question. In relation to that however. Has the code been worked on
> >> to make the process more efficient? I tried to rund the code i word 2007 on a
> >> document of about 100 pages and it takes like 30 minutes. Therefore if
> >> anybody know a faster or better way of coding this please help out.
> >
> >Every time you run through the paragraph collection, the code is slow.
> >
> >You could use Range.Find to speed things up.
> >
> >I do not have the time right now to rewrite the code and test it, but in a
> >nutshell: Define a range for the document.
> >Then find the first Heading 1 paragraph.
> >Then find the first Heading 2. paragraph.
> >Set a range ("Found1") starting at whichever range is the first in the
> >document (You would assume that it shold be HEading 1, but you never know!).
> >Then repeat the process, but now set a range starting at the end of the
> >found paragraph to the end of the document (It might be a heading 1 or a
> >Heading 2).
> >When you find the next heading, set the first range ("Found1") to finish
> >where the second found heading starts.
> >Export that range to a new document.
> >Rinse and repeat...
>
> --
> Message posted via
http://www.officekb.com
>
>