Hi,

I'm having trouble getting the numbering text of a ListNum field when
it is not the first numbering field in a paragraph.
I usually use the ListFormat.ListString property, but it doesn't work
in this case, as this property (and ListFormat in general) always gets
the first list entity in a paragraph.
So if I had this in the document:
"It happens fbecause: a) reason1, b) reason 2, c) reason 3"
the ListFormat.ListString for any range in this line (including the
listnum "Result" and "Code" ranges for any listnum field) would be
"a)".
The same happens if I have a listnum field after a bullet (don't ask me
why anyone would this, it's not my document :)), the code character for
the bullet is returned (whatever it is).

So, how can I get the resulting text of a listnum field, or the listnum
field immediately before the current selection (I have no trouble
finding the field, just getting the text)?

Hope you can help
Thanks

Re: Get numbering text when several ListNum on same line by Helmut

Helmut
Fri Feb 10 08:23:09 CST 2006

Hi Tiago,

I doubt, whether several listnumbers can be in one line,
not even in the same paragraph.

It seems, all readers here are puzzled about that.

You may send me a sample doc, if you can.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Re: Get numbering text when several ListNum on same line by Tiago

Tiago
Fri Feb 10 09:52:08 CST 2006

Hi again,

It seems to be possible, my client's files are full of them...
Even if it was not the case, the bullet/ListNum combination produces
the same result, where ListFormat.ListString return the text from the
first numbering field/item in the paragraph, in this case, the bullet.

I've sent you an example file by mail, which I've created myself
(Word97), hope you can take a look at it soon.

Cheers


Re: Get numbering text when several ListNum on same line by Helmut

Helmut
Sat Feb 11 04:40:18 CST 2006

Hi Tiago,

>I've sent you an example file by mail, which I've created myself
>(Word97), hope you can take a look at it soon.

I can't see that I got a mail from you.

Did you translate the mail-address below correctly?

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de" <<<

Re: Get numbering text when several ListNum on same line by Tiago

Tiago
Sun Feb 12 06:41:02 CST 2006

Oops, I used the e-mail address from your profile. I've just resent it.


Re: Get numbering text when several ListNum on same line by Tony

Tony
Sun Feb 12 06:43:59 CST 2006

This looks like a bug to me.

I have replied to your identical post in the numbering newsgroup. It is
better for all concerned if you don't multi-post.

--
Enjoy,
Tony


"Tiago" <tiago.marques@edisoft.pt> wrote in message
news:1139571297.052584.147700@g44g2000cwa.googlegroups.com...
> Hi,
>
> I'm having trouble getting the numbering text of a ListNum field when
> it is not the first numbering field in a paragraph.
> I usually use the ListFormat.ListString property, but it doesn't work
> in this case, as this property (and ListFormat in general) always gets
> the first list entity in a paragraph.
> So if I had this in the document:
> "It happens fbecause: a) reason1, b) reason 2, c) reason 3"
> the ListFormat.ListString for any range in this line (including the
> listnum "Result" and "Code" ranges for any listnum field) would be
> "a)".
> The same happens if I have a listnum field after a bullet (don't ask me
> why anyone would this, it's not my document :)), the code character for
> the bullet is returned (whatever it is).
>
> So, how can I get the resulting text of a listnum field, or the listnum
> field immediately before the current selection (I have no trouble
> finding the field, just getting the text)?
>
> Hope you can help
> Thanks
>



Re: Get numbering text when several ListNum on same line by Helmut

Helmut
Sun Feb 12 07:41:19 CST 2006

Hi Tiago,

got your doc now.

Only wierd approaches possible, I think.

Maybe like this, for not bulleted paragraphs!

Sub Myfields()
Dim oFld As Field
Dim sTmp As String
Dim lCnt As Long
With Selection.Paragraphs(1).Range
sTmp = .ListFormat.ListString
For Each oFld In .Fields
If oFld.Type = wdFieldListNum Then
lCnt = lCnt + 1
If lCnt > 1 Then
MsgBox chr(Asc(Left(sTmp, 1)) + 1) & Right(sTmp, 1)
' certainly somewhat limited
End If
End If
Next
End With
End Sub


For bulleted paragraphs, if I select the first field
of type wdFieldListNum in that paragraph and copy it
to the clipboard, I see "a)" in the clipboard.

From then on, it's doable, IMHO.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"




Re: Get numbering text when several ListNum on same line by Helmut

Helmut
Sun Feb 12 07:51:36 CST 2006

Hi

> MsgBox chr(Asc(Left(sTmp, 1)) + 1) & Right(sTmp, 1)

which is only an example for the first "b)" after "a)".

You have to use the counter lCnt
to get "c)", "d)", etc.

HW

Re: Get numbering text when several ListNum on same line by Tony

Tony
Sun Feb 12 08:06:52 CST 2006

Very clever, Helmut.

The clipboard is interesting. The Office clipboard shows a) b) c) etc for
the entries but pasting them (via the dropdown in the Task Pane) pastes
another LISTNUM - so "d)" perhaps. The Windows clipboard shows "1)" no
matter which number is copied - and Paste Special > Unformatted Text pastes
"1)".

--
Enjoy,
Tony


"Helmut Weber" <nbhymsjxdgcn@mailinator.com> wrote in message
news:drduu19cfjbnb66gimk9d81ch2rtijbg8n@4ax.com...
> Hi Tiago,
>
> got your doc now.
>
> Only wierd approaches possible, I think.
>
> Maybe like this, for not bulleted paragraphs!
>
> Sub Myfields()
> Dim oFld As Field
> Dim sTmp As String
> Dim lCnt As Long
> With Selection.Paragraphs(1).Range
> sTmp = .ListFormat.ListString
> For Each oFld In .Fields
> If oFld.Type = wdFieldListNum Then
> lCnt = lCnt + 1
> If lCnt > 1 Then
> MsgBox chr(Asc(Left(sTmp, 1)) + 1) & Right(sTmp, 1)
> ' certainly somewhat limited
> End If
> End If
> Next
> End With
> End Sub
>
>
> For bulleted paragraphs, if I select the first field
> of type wdFieldListNum in that paragraph and copy it
> to the clipboard, I see "a)" in the clipboard.
>
> From then on, it's doable, IMHO.
>
> --
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP WordVBA
>
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"
>
>
>



Re: Get numbering text when several ListNum on same line by Helmut

Helmut
Sun Feb 12 08:44:23 CST 2006

Hi Tony,

as long as the clipboard shows "1)" or "a)" it's alright.
One could then calculate the following not accessible
field results.

So far, I've not found a methode for retrieving
what's in the office clipboard.
Not to speak of other numbering schemata, like roman.

But that's theory.

Have a nice day.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"



Re: Get numbering text when several ListNum on same line by Tiago

Tiago
Sun Feb 12 16:02:39 CST 2006

Thank you all for your help.
I'd already though of this counting approach, but really thought there
ought to be a better way!
Seems not, though...
Since I never know what kind of numbering scheme the document as
(numerals, letters, roman, etc.) it's going to be a pain to account for
all "regular" cases).
But, if that's the way to go... So be it!

Cheers