In an outline numbered document, does the body text know anything
about the outline section in which it appears? I have an outline
numbered document and want to create a macro tol capture certain text
from the body, and in the front of the text, I want to put the level 3
outline heading of the section where the text appears. For example:

1. My House
A. Furniture
(1) Living Room
Coffee table
Sofa
Chair
End Table
(2) Kitchen
Dining Table
Chairs
B. Books
(1) Computer
ASP.Net Coding Strategies
Pivot Table Data Crunching
(2) Philosophy
Kitchen Table Wisdom
This was Cicero

The individual items are just body text.

Suppose I want to gather up a list of all the "tables", precede each
one with the room where it appears, and paste it into a second
document. The result would look like this:

Living Room: Coffee table
Living Room: End Table
Kitchen: Dining Table
Computer: Pivot Table Data Crunching
Philosophy: Kitchen Table Wisdom

I want to search for the word "table," select and copy that line, and
then grab the appropriate heading and stick it on the front, without
ever actually selecting and copying the heading. Is it possible?

Re: Grabbing an Outline Heading by Jezebel

Jezebel
Tue Feb 13 21:18:03 CST 2007

What you're after is certainly do-able in principle; but quite a lot of
work, and there are, in any case, any number of applications already around
that do exactly what you describe.

To do it in Word, you need to parse the document and build a data structure
that can be searched in the way you need.

You could maybe do it in Excel using pivot tables. You can certainly do it
using just about any database application you can find (and there are plenty
of free ones out there). You could even use an object editor like protege
(also free).



"MarsBar" <mbarnes@controltec.com> wrote in message
news:1171421445.610230.288760@s48g2000cws.googlegroups.com...
> In an outline numbered document, does the body text know anything
> about the outline section in which it appears? I have an outline
> numbered document and want to create a macro tol capture certain text
> from the body, and in the front of the text, I want to put the level 3
> outline heading of the section where the text appears. For example:
>
> 1. My House
> A. Furniture
> (1) Living Room
> Coffee table
> Sofa
> Chair
> End Table
> (2) Kitchen
> Dining Table
> Chairs
> B. Books
> (1) Computer
> ASP.Net Coding Strategies
> Pivot Table Data Crunching
> (2) Philosophy
> Kitchen Table Wisdom
> This was Cicero
>
> The individual items are just body text.
>
> Suppose I want to gather up a list of all the "tables", precede each
> one with the room where it appears, and paste it into a second
> document. The result would look like this:
>
> Living Room: Coffee table
> Living Room: End Table
> Kitchen: Dining Table
> Computer: Pivot Table Data Crunching
> Philosophy: Kitchen Table Wisdom
>
> I want to search for the word "table," select and copy that line, and
> then grab the appropriate heading and stick it on the front, without
> ever actually selecting and copying the heading. Is it possible?
>



Re: Grabbing an Outline Heading by MarsBar

MarsBar
Tue Feb 13 22:03:57 CST 2007

I'm afraid I oversimplified my example. The Word document I'm working
with is a lot more complex than I described. It wouldn't neatly fit
into a database structure. Each "Level 3" is actually a detailed
description of a web page, complete with screen shot, tables, event
descriptions, and data access. Out of that whole mess, I just want to
pluck every line that starts with "Stored Procedure Name:" and paste
that line into a new document, along with the name of the screen where
it appears. (The screen name is the Level 3 Heading).

Here is how I'm doing it now:

Start at the top
Go to the next heading
If that heading isn't level 3, go to the next heading.
If it IS level 3, then:
1) Select the heading text and assign it to strCurrentHeading.
2) Select the whole body under this heading and paste it into a new
screen, call it TempScreen1.
Then search TempScreen1 for "Stored Procedure Name:" Select that whole
line and paste it into a third document, call it StoredProcList.doc,
preceded by strCurrentHeading.
Keep doing that until "Stored Procedure Name:" isn't found.
Then erase everything from TempScreen1 and go back to the main
document and find the next level 3 heading.
Repeat until there are no more headings.

The problem is, it's messy and prone to error, especially the bit
about selecting the whole section. Here's how I want to do it:
Start at the top
Search for "Stored Procedure Name:"
Determine the Selection.Level3HeadingName and assign it to
strCurrentHeading.
Select the whole line and copy it.
Switch to StoredProcList.doc. Paste in strCurrentHeading and the name
of the stored procedure.
Switch back to main document, lather, rinse, repeat.

That would work beautifully, assuming that something like
Selection.Level3HeadingName exists. Does it?



On Feb 13, 7:18 pm, "Jezebel" <warcri...@whitehouse.gov> wrote:
> What you're after is certainly do-able in principle; but quite a lot of
> work, and there are, in any case, any number of applications already around
> that do exactly what you describe.
>
> To do it in Word, you need to parse the document and build a data structure
> that can be searched in the way you need.
>
> You could maybe do it in Excel using pivot tables. You can certainly do it
> using just about any database application you can find (and there are plenty
> of free ones out there). You could even use an object editor like protege
> (also free).
>
> "MarsBar" <mbar...@controltec.com> wrote in message
>
> news:1171421445.610230.288760@s48g2000cws.googlegroups.com...
>
>
>
> > In an outline numbered document, does the body text know anything
> > about the outline section in which it appears? I have an outline
> > numbered document and want to create a macro tol capture certain text
> > from the body, and in the front of the text, I want to put the level 3
> > outline heading of the section where the text appears. For example:
>
> > 1. My House
> > A. Furniture
> > (1) Living Room
> > Coffee table
> > Sofa
> > Chair
> > End Table
> > (2) Kitchen
> > Dining Table
> > Chairs
> > B. Books
> > (1) Computer
> > ASP.Net Coding Strategies
> > Pivot Table Data Crunching
> > (2) Philosophy
> > Kitchen Table Wisdom
> > This was Cicero
>
> > The individual items are just body text.
>
> > Suppose I want to gather up a list of all the "tables", precede each
> > one with the room where it appears, and paste it into a second
> > document. The result would look like this:
>
> > Living Room: Coffee table
> > Living Room: End Table
> > Kitchen: Dining Table
> > Computer: Pivot Table Data Crunching
> > Philosophy: Kitchen Table Wisdom
>
> > I want to search for the word "table," select and copy that line, and
> > then grab the appropriate heading and stick it on the front, without
> > ever actually selecting and copying the heading. Is it possible?- Hide quoted text -
>
> - Show quoted text -



Re: Grabbing an Outline Heading by Jezebel

Jezebel
Tue Feb 13 22:13:53 CST 2007

You could do it like this --

1. Iterate the paragraphs of the document.
2. If the paragraph is a level-3 heading, save it strCurrentHeading.
3. Else if the paragraph begins "Stored Procedure Name:", write
strCurrentHeading & paragraph range into your second document
4. Ignore all other paragraphs





"MarsBar" <mbarnes@controltec.com> wrote in message
news:1171425837.128847.237140@k78g2000cwa.googlegroups.com...
> I'm afraid I oversimplified my example. The Word document I'm working
> with is a lot more complex than I described. It wouldn't neatly fit
> into a database structure. Each "Level 3" is actually a detailed
> description of a web page, complete with screen shot, tables, event
> descriptions, and data access. Out of that whole mess, I just want to
> pluck every line that starts with "Stored Procedure Name:" and paste
> that line into a new document, along with the name of the screen where
> it appears. (The screen name is the Level 3 Heading).
>
> Here is how I'm doing it now:
>
> Start at the top
> Go to the next heading
> If that heading isn't level 3, go to the next heading.
> If it IS level 3, then:
> 1) Select the heading text and assign it to strCurrentHeading.
> 2) Select the whole body under this heading and paste it into a new
> screen, call it TempScreen1.
> Then search TempScreen1 for "Stored Procedure Name:" Select that whole
> line and paste it into a third document, call it StoredProcList.doc,
> preceded by strCurrentHeading.
> Keep doing that until "Stored Procedure Name:" isn't found.
> Then erase everything from TempScreen1 and go back to the main
> document and find the next level 3 heading.
> Repeat until there are no more headings.
>
> The problem is, it's messy and prone to error, especially the bit
> about selecting the whole section. Here's how I want to do it:
> Start at the top
> Search for "Stored Procedure Name:"
> Determine the Selection.Level3HeadingName and assign it to
> strCurrentHeading.
> Select the whole line and copy it.
> Switch to StoredProcList.doc. Paste in strCurrentHeading and the name
> of the stored procedure.
> Switch back to main document, lather, rinse, repeat.
>
> That would work beautifully, assuming that something like
> Selection.Level3HeadingName exists. Does it?
>
>
>
> On Feb 13, 7:18 pm, "Jezebel" <warcri...@whitehouse.gov> wrote:
>> What you're after is certainly do-able in principle; but quite a lot of
>> work, and there are, in any case, any number of applications already
>> around
>> that do exactly what you describe.
>>
>> To do it in Word, you need to parse the document and build a data
>> structure
>> that can be searched in the way you need.
>>
>> You could maybe do it in Excel using pivot tables. You can certainly do
>> it
>> using just about any database application you can find (and there are
>> plenty
>> of free ones out there). You could even use an object editor like protege
>> (also free).
>>
>> "MarsBar" <mbar...@controltec.com> wrote in message
>>
>> news:1171421445.610230.288760@s48g2000cws.googlegroups.com...
>>
>>
>>
>> > In an outline numbered document, does the body text know anything
>> > about the outline section in which it appears? I have an outline
>> > numbered document and want to create a macro tol capture certain text
>> > from the body, and in the front of the text, I want to put the level 3
>> > outline heading of the section where the text appears. For example:
>>
>> > 1. My House
>> > A. Furniture
>> > (1) Living Room
>> > Coffee table
>> > Sofa
>> > Chair
>> > End Table
>> > (2) Kitchen
>> > Dining Table
>> > Chairs
>> > B. Books
>> > (1) Computer
>> > ASP.Net Coding Strategies
>> > Pivot Table Data Crunching
>> > (2) Philosophy
>> > Kitchen Table Wisdom
>> > This was Cicero
>>
>> > The individual items are just body text.
>>
>> > Suppose I want to gather up a list of all the "tables", precede each
>> > one with the room where it appears, and paste it into a second
>> > document. The result would look like this:
>>
>> > Living Room: Coffee table
>> > Living Room: End Table
>> > Kitchen: Dining Table
>> > Computer: Pivot Table Data Crunching
>> > Philosophy: Kitchen Table Wisdom
>>
>> > I want to search for the word "table," select and copy that line, and
>> > then grab the appropriate heading and stick it on the front, without
>> > ever actually selecting and copying the heading. Is it possible?- Hide
>> > quoted text -
>>
>> - Show quoted text -
>
>



Re: Grabbing an Outline Heading by MarsBar

MarsBar
Wed Feb 14 12:50:24 CST 2007

Very nice. That will work. Thanks.

(But I'd still like to have something like
Selection.CurrentOutlineHeading, if any Word develoopers are
listening.)

On Feb 13, 8:13 pm, "Jezebel" <warcri...@whitehouse.gov> wrote:
> You could do it like this --
>
> 1. Iterate the paragraphs of the document.
> 2. If the paragraph is a level-3 heading, save it strCurrentHeading.
> 3. Else if the paragraph begins "Stored Procedure Name:", write
> strCurrentHeading & paragraph range into your second document
> 4. Ignore all other paragraphs
>
> "MarsBar" <mbar...@controltec.com> wrote in message
>
> news:1171425837.128847.237140@k78g2000cwa.googlegroups.com...
>
>
>
> > I'm afraid I oversimplified my example. The Word document I'm working
> > with is a lot more complex than I described. It wouldn't neatly fit
> > into a database structure. Each "Level 3" is actually a detailed
> > description of a web page, complete with screen shot, tables, event
> > descriptions, and data access. Out of that whole mess, I just want to
> > pluck every line that starts with "Stored Procedure Name:" and paste
> > that line into a new document, along with the name of the screen where
> > it appears. (The screen name is the Level 3 Heading).
>
> > Here is how I'm doing it now:
>
> > Start at the top
> > Go to the next heading
> > If that heading isn't level 3, go to the next heading.
> > If it IS level 3, then:
> > 1) Select the heading text and assign it to strCurrentHeading.
> > 2) Select the whole body under this heading and paste it into a new
> > screen, call it TempScreen1.
> > Then search TempScreen1 for "Stored Procedure Name:" Select that whole
> > line and paste it into a third document, call it StoredProcList.doc,
> > preceded by strCurrentHeading.
> > Keep doing that until "Stored Procedure Name:" isn't found.
> > Then erase everything from TempScreen1 and go back to the main
> > document and find the next level 3 heading.
> > Repeat until there are no more headings.
>
> > The problem is, it's messy and prone to error, especially the bit
> > about selecting the whole section. Here's how I want to do it:
> > Start at the top
> > Search for "Stored Procedure Name:"
> > Determine the Selection.Level3HeadingName and assign it to
> > strCurrentHeading.
> > Select the whole line and copy it.
> > Switch to StoredProcList.doc. Paste in strCurrentHeading and the name
> > of the stored procedure.
> > Switch back to main document, lather, rinse, repeat.
>
> > That would work beautifully, assuming that something like
> > Selection.Level3HeadingName exists. Does it?
>
> > On Feb 13, 7:18 pm, "Jezebel" <warcri...@whitehouse.gov> wrote:
> >> What you're after is certainly do-able in principle; but quite a lot of
> >> work, and there are, in any case, any number of applications already
> >> around
> >> that do exactly what you describe.
>
> >> To do it in Word, you need to parse the document and build a data
> >> structure
> >> that can be searched in the way you need.
>
> >> You could maybe do it in Excel using pivot tables. You can certainly do
> >> it
> >> using just about any database application you can find (and there are
> >> plenty
> >> of free ones out there). You could even use an object editor like protege
> >> (also free).
>
> >> "MarsBar" <mbar...@controltec.com> wrote in message
>
> >>news:1171421445.610230.288760@s48g2000cws.googlegroups.com...
>
> >> > In an outline numbered document, does the body text know anything
> >> > about the outline section in which it appears? I have an outline
> >> > numbered document and want to create a macro tol capture certain text
> >> > from the body, and in the front of the text, I want to put the level 3
> >> > outline heading of the section where the text appears. For example:
>
> >> > 1. My House
> >> > A. Furniture
> >> > (1) Living Room
> >> > Coffee table
> >> > Sofa
> >> > Chair
> >> > End Table
> >> > (2) Kitchen
> >> > Dining Table
> >> > Chairs
> >> > B. Books
> >> > (1) Computer
> >> > ASP.Net Coding Strategies
> >> > Pivot Table Data Crunching
> >> > (2) Philosophy
> >> > Kitchen Table Wisdom
> >> > This was Cicero
>
> >> > The individual items are just body text.
>
> >> > Suppose I want to gather up a list of all the "tables", precede each
> >> > one with the room where it appears, and paste it into a second
> >> > document. The result would look like this:
>
> >> > Living Room: Coffee table
> >> > Living Room: End Table
> >> > Kitchen: Dining Table
> >> > Computer: Pivot Table Data Crunching
> >> > Philosophy: Kitchen Table Wisdom
>
> >> > I want to search for the word "table," select and copy that line, and
> >> > then grab the appropriate heading and stick it on the front, without
> >> > ever actually selecting and copying the heading. Is it possible?- Hide
> >> > quoted text -
>
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -