I would like to know if it is possible to get the "value" of a heading that
Word is using programmatically. I will try to clarify my question with a
demonstration. If I have a document and I set it to use a numbered heading
style for its layout, I might have something that looks like:

1. Overview
2. Introduction
3. How to do it 101
3.1 Starting
3.2 Finding Help
4. Advanced Options

In this case, the leading number and period are supplied by the style, and I
simply type in the text (Overview, Introduction, etc.). When I parse this
document in VBA, I can get the style names and the text, but I'm not sure
how (if it is even possible) to get the characters Word is automatically
generating (1., 2., etc.). Outlined below is a little pseudo code to
provide an idea of where I'm currently sitting:

for each section in WordDoc.Sections
for each paragraph in section.Paragraphs
' Get the text - Overview, Introduction, etc.
text = paragraph.Range.Text

' Get the style name - Heading 1, Heading 2, etc.
styleName = paragraph.style.NameLocal

' How can I get the text Word is putting in based on the style?
<< Unknown code here >>

' Do some stuff with the information.
next
next

Any help would be much appreciated.

Thanks, Tyler

Re: How to Obtain the Generated Text of a Style by Dave

Dave
Wed Feb 02 06:41:38 CST 2005

Hi Tyler,

I'm not sure how it will fit into your pseudo code (i.e., "based on style"),
but I thought you might find the following useful:

With Selection.Paragraphs(1).Range.ListFormat
Debug.Print .ListString
End With

HTH,
Dave

"Tyler" <Tyler@newsgroups.nospam> wrote in message
news:eDRyJISCFHA.3120@TK2MSFTNGP12.phx.gbl...
> I would like to know if it is possible to get the "value" of a heading
that
> Word is using programmatically. I will try to clarify my question with a
> demonstration. If I have a document and I set it to use a numbered
heading
> style for its layout, I might have something that looks like:
>
> 1. Overview
> 2. Introduction
> 3. How to do it 101
> 3.1 Starting
> 3.2 Finding Help
> 4. Advanced Options
>
> In this case, the leading number and period are supplied by the style, and
I
> simply type in the text (Overview, Introduction, etc.). When I parse this
> document in VBA, I can get the style names and the text, but I'm not sure
> how (if it is even possible) to get the characters Word is automatically
> generating (1., 2., etc.). Outlined below is a little pseudo code to
> provide an idea of where I'm currently sitting:
>
> for each section in WordDoc.Sections
> for each paragraph in section.Paragraphs
> ' Get the text - Overview, Introduction, etc.
> text = paragraph.Range.Text
>
> ' Get the style name - Heading 1, Heading 2, etc.
> styleName = paragraph.style.NameLocal
>
> ' How can I get the text Word is putting in based on the style?
> << Unknown code here >>
>
> ' Do some stuff with the information.
> next
> next
>
> Any help would be much appreciated.
>
> Thanks, Tyler
>
>



Re: How to Obtain the Generated Text of a Style by Tyler

Tyler
Wed Feb 02 09:52:59 CST 2005

Thank you, that is awesome! It's exactly what I was looking for. Do you
have any good reference material/web sites you would recommend for figuring
out this sort-of information?

Thanks, Tyler

"Dave Lett" <dlett@NOsmconst.comSPAM.com> wrote in message
news:OSJ9JSSCFHA.3740@TK2MSFTNGP09.phx.gbl...
> Hi Tyler,
>
> I'm not sure how it will fit into your pseudo code (i.e., "based on
> style"),
> but I thought you might find the following useful:
>
> With Selection.Paragraphs(1).Range.ListFormat
> Debug.Print .ListString
> End With
>
> HTH,
> Dave
>
> "Tyler" <Tyler@newsgroups.nospam> wrote in message
> news:eDRyJISCFHA.3120@TK2MSFTNGP12.phx.gbl...
>> I would like to know if it is possible to get the "value" of a heading
> that
>> Word is using programmatically. I will try to clarify my question with a
>> demonstration. If I have a document and I set it to use a numbered
> heading
>> style for its layout, I might have something that looks like:
>>
>> 1. Overview
>> 2. Introduction
>> 3. How to do it 101
>> 3.1 Starting
>> 3.2 Finding Help
>> 4. Advanced Options
>>
>> In this case, the leading number and period are supplied by the style,
>> and
> I
>> simply type in the text (Overview, Introduction, etc.). When I parse
>> this
>> document in VBA, I can get the style names and the text, but I'm not sure
>> how (if it is even possible) to get the characters Word is automatically
>> generating (1., 2., etc.). Outlined below is a little pseudo code to
>> provide an idea of where I'm currently sitting:
>>
>> for each section in WordDoc.Sections
>> for each paragraph in section.Paragraphs
>> ' Get the text - Overview, Introduction, etc.
>> text = paragraph.Range.Text
>>
>> ' Get the style name - Heading 1, Heading 2, etc.
>> styleName = paragraph.style.NameLocal
>>
>> ' How can I get the text Word is putting in based on the style?
>> << Unknown code here >>
>>
>> ' Do some stuff with the information.
>> next
>> next
>>
>> Any help would be much appreciated.
>>
>> Thanks, Tyler
>>
>>
>
>



Re: How to Obtain the Generated Text of a Style by Dave

Dave
Wed Feb 02 10:18:45 CST 2005

Hi Tyler,

This sort of information? Well, no, I don't. I like the Word MVPs site
(http://word.mvps.org/), but I don't think this is addressed there. For this
one, I simply knew that I needed to poke around with "List" and see what I
could stumble upon.

Dave

"Tyler" <Tyler@newsgroups.nospam> wrote in message
news:eNlUG9TCFHA.3368@TK2MSFTNGP10.phx.gbl...
> Thank you, that is awesome! It's exactly what I was looking for. Do you
> have any good reference material/web sites you would recommend for
figuring
> out this sort-of information?
>
> Thanks, Tyler
>
> "Dave Lett" <dlett@NOsmconst.comSPAM.com> wrote in message
> news:OSJ9JSSCFHA.3740@TK2MSFTNGP09.phx.gbl...
> > Hi Tyler,
> >
> > I'm not sure how it will fit into your pseudo code (i.e., "based on
> > style"),
> > but I thought you might find the following useful:
> >
> > With Selection.Paragraphs(1).Range.ListFormat
> > Debug.Print .ListString
> > End With
> >
> > HTH,
> > Dave
> >
> > "Tyler" <Tyler@newsgroups.nospam> wrote in message
> > news:eDRyJISCFHA.3120@TK2MSFTNGP12.phx.gbl...
> >> I would like to know if it is possible to get the "value" of a heading
> > that
> >> Word is using programmatically. I will try to clarify my question with
a
> >> demonstration. If I have a document and I set it to use a numbered
> > heading
> >> style for its layout, I might have something that looks like:
> >>
> >> 1. Overview
> >> 2. Introduction
> >> 3. How to do it 101
> >> 3.1 Starting
> >> 3.2 Finding Help
> >> 4. Advanced Options
> >>
> >> In this case, the leading number and period are supplied by the style,
> >> and
> > I
> >> simply type in the text (Overview, Introduction, etc.). When I parse
> >> this
> >> document in VBA, I can get the style names and the text, but I'm not
sure
> >> how (if it is even possible) to get the characters Word is
automatically
> >> generating (1., 2., etc.). Outlined below is a little pseudo code to
> >> provide an idea of where I'm currently sitting:
> >>
> >> for each section in WordDoc.Sections
> >> for each paragraph in section.Paragraphs
> >> ' Get the text - Overview, Introduction, etc.
> >> text = paragraph.Range.Text
> >>
> >> ' Get the style name - Heading 1, Heading 2, etc.
> >> styleName = paragraph.style.NameLocal
> >>
> >> ' How can I get the text Word is putting in based on the style?
> >> << Unknown code here >>
> >>
> >> ' Do some stuff with the information.
> >> next
> >> next
> >>
> >> Any help would be much appreciated.
> >>
> >> Thanks, Tyler
> >>
> >>
> >
> >
>
>



Re: How to Obtain the Generated Text of a Style by Klaus

Klaus
Tue Feb 08 13:05:56 CST 2005

"Dave Lett" wrote:
> Hi Tyler,
>
> This sort of information? Well, no, I don't. I like the Word MVPs site
> (http://word.mvps.org/), but I don't think this is addressed there. For this
> one, I simply knew that I needed to poke around with "List" and see what I
> could stumble upon.
>
> Dave


It's there in the MVP FAQs, but maybe hard to find if you don't know already
what to search for (say, ListString):
http://www.word.mvps.org/faqs/numbering/ListString.htm

Regards,
Klaus



Re: How to Obtain the Generated Text of a Style by Dave

Dave
Wed Feb 09 05:37:03 CST 2005

I stand corrected, thank you.

Dave

"Klaus Linke" <info@fotosatz-kaufmann.de> wrote in message
news:uGgs5EhDFHA.2756@TK2MSFTNGP15.phx.gbl...
> "Dave Lett" wrote:
> > Hi Tyler,
> >
> > This sort of information? Well, no, I don't. I like the Word MVPs site
> > (http://word.mvps.org/), but I don't think this is addressed there. For
this
> > one, I simply knew that I needed to poke around with "List" and see what
I
> > could stumble upon.
> >
> > Dave
>
>
> It's there in the MVP FAQs, but maybe hard to find if you don't know
already
> what to search for (say, ListString):
> http://www.word.mvps.org/faqs/numbering/ListString.htm
>
> Regards,
> Klaus
>
>



Re: How to Obtain the Generated Text of a Style by Klaus

Klaus
Wed Feb 09 10:18:42 CST 2005

Hi Dave,

I didn't find it easily, either. I just *knew* it was there and kept looking.
And you said you *thought* there wasn't an article, so no correction was called
for...

;-) Klaus


"Dave Lett" <dlett@NOsmconst.comSPAM.com> wrote:
> I stand corrected, thank you.
>
> Dave
>
> "Klaus Linke" <info@fotosatz-kaufmann.de> wrote in message
> news:uGgs5EhDFHA.2756@TK2MSFTNGP15.phx.gbl...
> > "Dave Lett" wrote:
> > > Hi Tyler,
> > >
> > > This sort of information? Well, no, I don't. I like the Word MVPs site
> > > (http://word.mvps.org/), but I don't think this is addressed there. For
> > > this one, I simply knew that I needed to poke around with "List" and
> > > see what I could stumble upon.
> > >
> > > Dave
> >
> >
> > It's there in the MVP FAQs, but maybe hard to find if you don't know
> > already what to search for (say, ListString):
> > http://www.word.mvps.org/faqs/numbering/ListString.htm
> >
> > Regards,
> > Klaus
> >
> >
>
>