Hello all
Is it at all possible to return the full paragraph number
from an outline numbered paragraph. The ListString
property only returns the text of the number of the given
para - I want all it's higher numbers as well. For
example, in:
5. some text
a) more text
i) even more
I want to return "5.a.i" for the "even more" paragraph.
Here's hoping
Trevor

Re: Determine full paragraph number string by Helmut

Helmut
Thu Dec 11 08:16:57 CST 2003

Hi Trevor,
yes, it is.
The following code may need a bit of refinemant.
Is is assumed, that the cursor is in a listparagraph.

Dim s As String ' the accumulated liststring
Dim l As Integer ' the listlevel
Dim p As Integer ' a counter for listparagraphs
Dim r As Range ' a range
Selection.Collapse direction:=wdCollapseStart
Set r = Selection.Range
r.start = 0
r.End = Selection.start
l = Selection.Range.ListFormat.ListLevelNumber
s = Selection.Range.ListFormat.ListString & s
For p = r.ListParagraphs.Count - 1 To 1 Step -1
If r.ListParagraphs(p).Range.ListFormat.ListLevelNumber <
l Then
s = r.ListParagraphs(p).Range.ListFormat.ListString & s
l = r.ListParagraphs(p).Range.ListFormat.ListLevelNumber
End If
Next
MsgBox s
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, NT 4.0


Re: Determine full paragraph number string by Klaus

Klaus
Thu Dec 11 13:10:50 CST 2003

Hi Trevor,

If you need the full context in a cross reference, you could try the \w
switch, or choose "Paragraph number (full context)" in the dialog.
You would get 5.a)i) though, in your example.

In case you need the full context in cross references, it might be
reasonable to change the numbering to
> 5. some text
> a. more text
> i. even more
to simplify things.

Regards,
Klaus


"Trevor" <anonymous@discussions.microsoft.com> wrote:
> Hello all
> Is it at all possible to return the full paragraph number
> from an outline numbered paragraph. The ListString
> property only returns the text of the number of the given
> para - I want all it's higher numbers as well. For
> example, in:
> 5. some text
> a) more text
> i) even more
> I want to return "5.a.i" for the "even more" paragraph.
> Here's hoping
> Trevor



Re: Determine full paragraph number string by EmpyreanEmpathy

EmpyreanEmpathy
Thu Dec 11 18:09:43 CST 2003

Trevor

There is yet another way to do this provided you are using the
built-in Heading styles (it will not work without them):

{ STYLEREF 1 \S }{ STYLEREF 2 \S }{ STYLEREF 3 \S ) = 5.1)i)

This use of the STYLEREF field is undocumented but can come in very
handy.

Selecting the field and pressing Shift-Ctrl converts the field to
text, should you want to do that.

The whole thing could be automated in VBA as well. Hope this gives you
another alternative. - Bruce


"Klaus Linke" <fotosatz_kaufmann@t-online.de> wrote in message news:<O#QXzpBwDHA.2492@TK2MSFTNGP12.phx.gbl>...
> Hi Trevor,
>
> If you need the full context in a cross reference, you could try the \w
> switch, or choose "Paragraph number (full context)" in the dialog.
> You would get 5.a)i) though, in your example.
>
> In case you need the full context in cross references, it might be
> reasonable to change the numbering to
> > 5. some text
> > a. more text
> > i. even more
> to simplify things.
>
> Regards,
> Klaus
>
>
> "Trevor" <anonymous@discussions.microsoft.com> wrote:
> > Hello all
> > Is it at all possible to return the full paragraph number
> > from an outline numbered paragraph. The ListString
> > property only returns the text of the number of the given
> > para - I want all it's higher numbers as well. For
> > example, in:
> > 5. some text
> > a) more text
> > i) even more
> > I want to return "5.a.i" for the "even more" paragraph.
> > Here's hoping
> > Trevor

Re: Determine full paragraph number string by JGM

JGM
Thu Dec 11 19:02:14 CST 2003


"Bruce Brown" <EmpyreanEmpathy@aol.com> a écrit dans le message de news:
1d2f086c.0312111609.54b0d727@posting.google.com...
> Trevor
>
> There is yet another way to do this provided you are using the
> built-in Heading styles (it will not work without them):
>
> { STYLEREF 1 \S }{ STYLEREF 2 \S }{ STYLEREF 3 \S ) = 5.1)i)
>
> This use of the STYLEREF field is undocumented but can come in very
> handy.
>
> Selecting the field and pressing Shift-Ctrl converts the field to
> text, should you want to do that.

Shouldn't it be SHIFT-CTRL-F9?
Or are you talking about something else?

--
_______________________________________
Jean-Guy Marcil
jmarcil@sympatico.ca




Re: Determine full paragraph number string by Klaus

Klaus
Thu Dec 11 18:28:17 CST 2003

Hi Bruce,

Didn't think of that possibility... nice!
It would be useful if you want to reference the current number.

The method should work with any style.
{ STYLEREF 1 } is just a shortcut for { STYLEREF "Heading 1" } ...
(useful if you want to make it independent of the English version).

{ STYLEREF "List Number" \S } ... should work, too.

{ STYLEREF 3 \w } would give you 5.1)i)
With your method, you get the pure number (at least in Word2002, I do),
so
{ STYLEREF 1 \S }.{ STYLEREF 2 \S }.{ STYLEREF 3 \S }.
will get you 5.1.i., even if the styles use 5., 1), and i)

Greetings,
Klaus



"Bruce Brown" <EmpyreanEmpathy@aol.com> wrote:
> Trevor
>
> There is yet another way to do this provided you are using the
> built-in Heading styles (it will not work without them):
>
> { STYLEREF 1 \S }{ STYLEREF 2 \S }{ STYLEREF 3 \S ) = 5.1)i)
>
> This use of the STYLEREF field is undocumented but can come in very
> handy.
>
> Selecting the field and pressing Shift-Ctrl converts the field to
> text, should you want to do that.
>
> The whole thing could be automated in VBA as well. Hope this gives you
> another alternative. - Bruce



Re: Determine full paragraph number string by JGM

JGM
Thu Dec 11 20:57:41 CST 2003

"Klaus Linke" <fotosatz_kaufmann@t-online.de> a écrit dans le message de
news: ugU9wsEwDHA.2368@TK2MSFTNGP09.phx.gbl...
> Hi Bruce,
>
> Didn't think of that possibility... nice!

Very nice indeed!

> It would be useful if you want to reference the current number.
>
> The method should work with any style.

It does (and so do all the examples you provided below!), I just tested it
under Word XP.

Cheers!
--
_______________________________________
Jean-Guy Marcil
jmarcil@sympatico.ca


> { STYLEREF 1 } is just a shortcut for { STYLEREF "Heading 1" } ...
> (useful if you want to make it independent of the English version).
>
> { STYLEREF "List Number" \S } ... should work, too.
>
> { STYLEREF 3 \w } would give you 5.1)i)
> With your method, you get the pure number (at least in Word2002, I do),
> so
> { STYLEREF 1 \S }.{ STYLEREF 2 \S }.{ STYLEREF 3 \S }.
> will get you 5.1.i., even if the styles use 5., 1), and i)
>
> Greetings,
> Klaus
>
>
>
> "Bruce Brown" <EmpyreanEmpathy@aol.com> wrote:
> > Trevor
> >
> > There is yet another way to do this provided you are using the
> > built-in Heading styles (it will not work without them):
> >
> > { STYLEREF 1 \S }{ STYLEREF 2 \S }{ STYLEREF 3 \S ) = 5.1)i)
> >
> > This use of the STYLEREF field is undocumented but can come in very
> > handy.
> >
> > Selecting the field and pressing Shift-Ctrl converts the field to
> > text, should you want to do that.
> >
> > The whole thing could be automated in VBA as well. Hope this gives you
> > another alternative. - Bruce
>
>



Re: Determine full paragraph number string by EmpyreanEmpathy

EmpyreanEmpathy
Fri Dec 12 10:47:26 CST 2003

Oui, Jean-Guy, Shift-Ctrl without F9 was a typo and should have been
Shift-Ctrl-F9.

Klaus, you say "(useful if you want to make it independent of the
English version)." Why would anyone want to do that? (Ha ha ha.)

I almost felt smart for a half second until you came along and showed
all the other STYLEREF examples. It's back to the scarecrow mode for
me while you fly straight to the Wizard with Toto under your arm.
Showoff! - Bruce


"JGM" <no-spam@leaveme.alone> wrote in message news:<u#8eKrFwDHA.2880@tk2msftngp13.phx.gbl>...
> "Klaus Linke" <fotosatz_kaufmann@t-online.de> a écrit dans le message de
> news: ugU9wsEwDHA.2368@TK2MSFTNGP09.phx.gbl...
> > Hi Bruce,
> >
> > Didn't think of that possibility... nice!
>
> Very nice indeed!
>
> > It would be useful if you want to reference the current number.
> >
> > The method should work with any style.
>
> It does (and so do all the examples you provided below!), I just tested it
> under Word XP.
>
> Cheers!
> --
> _______________________________________
> Jean-Guy Marcil
> jmarcil@sympatico.ca
>
>
> > { STYLEREF 1 } is just a shortcut for { STYLEREF "Heading 1" } ...
> > (useful if you want to make it independent of the English version).
> >
> > { STYLEREF "List Number" \S } ... should work, too.
> >
> > { STYLEREF 3 \w } would give you 5.1)i)
> > With your method, you get the pure number (at least in Word2002, I do),
> > so
> > { STYLEREF 1 \S }.{ STYLEREF 2 \S }.{ STYLEREF 3 \S }.
> > will get you 5.1.i., even if the styles use 5., 1), and i)
> >
> > Greetings,
> > Klaus
> >
> >
> >
> > "Bruce Brown" <EmpyreanEmpathy@aol.com> wrote:
> > > Trevor
> > >
> > > There is yet another way to do this provided you are using the
> > > built-in Heading styles (it will not work without them):
> > >
> > > { STYLEREF 1 \S }{ STYLEREF 2 \S }{ STYLEREF 3 \S ) = 5.1)i)
> > >
> > > This use of the STYLEREF field is undocumented but can come in very
> > > handy.
> > >
> > > Selecting the field and pressing Shift-Ctrl converts the field to
> > > text, should you want to do that.
> > >
> > > The whole thing could be automated in VBA as well. Hope this gives you
> > > another alternative. - Bruce
> >
> >

Re: Determine full paragraph number string by Klaus

Klaus
Fri Dec 12 11:01:17 CST 2003

> Klaus, you say "(useful if you want to make it independent of the
> English version)." Why would anyone want to do that? (Ha ha ha.)

Well, we are not in Kansas anymore...

;-) Klaus