Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Numbering / March 2005

Tip: Looking for answers? Try searching our database.

Numbered List Count?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ML - 24 Feb 2005 22:38 GMT
Is there a way to get the total number of items in a numbered list?

I have a list with a unique style applied to it and I would like to get the
count of how many items are in the list so I can display the count at
another location in the document.

Any ideas?
Suzanne S. Barnhill - 25 Feb 2005 01:32 GMT
Insert a cross-reference to the paragraph number of the last item in the
list.

Signature

Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

> Is there a way to get the total number of items in a numbered list?
>
[quoted text clipped - 3 lines]
>
> Any ideas?
ML - 25 Feb 2005 18:13 GMT
I need something that will work without user intervention, ie this is a
custom template and I cannot depend on a user creating a cross reference.  I
know that the style will be set but the number of references will always be
different so I cannot preset a cross-reference to this item.  I need to
somehow do this in code after the fact if possible.

> Insert a cross-reference to the paragraph number of the last item in the
> list.
[quoted text clipped - 7 lines]
> >
> > Any ideas?
Daiya Mitchell - 26 Feb 2005 15:02 GMT
Then you should ask in a Word newsgroup that also has VBA or Programming in
the name.

> I need something that will work without user intervention, ie this is a
> custom template and I cannot depend on a user creating a cross reference.  I
[quoted text clipped - 4 lines]
>> Insert a cross-reference to the paragraph number of the last item in the
>> list.
ML - 26 Feb 2005 15:13 GMT
Sorry for asking I guess.  I thought someone here might know since this is a
numbering group.  The solution does not need to be VBA related, it just
needs to be automatic without the user making a reference.

> Then you should ask in a Word newsgroup that also has VBA or Programming
> in
[quoted text clipped - 10 lines]
>>> Insert a cross-reference to the paragraph number of the last item in the
>>> list.
Daiya Mitchell - 26 Feb 2005 19:30 GMT
Oh, I was thrown off by you saying you need to do it in code.

Anyhow, in general the way to do anything without user intervention is to
use a macro aka VBA.  Even custom templates require user intervention.  You
are asking for something complicated--you want to find the number of items
in a list that doesn't exist yet, and that involves several steps.  I think
you will need VBA to find the list, count the items, and put the answer
somewhere. Word doesn't appear to have pre-defined fields for anything like
"# of paragraphs in a certain style" or "# of entries in a numbered list,"
which is what you would need.

It's be a nice feature if the NumParas field had such switches, but since
there doesn't even seem to be a NumParas field, guess not.

> Sorry for asking I guess.  I thought someone here might know since this is a
> numbering group.  The solution does not need to be VBA related, it just
[quoted text clipped - 14 lines]
>>>> Insert a cross-reference to the paragraph number of the last item in the
>>>> list.
ML - 27 Feb 2005 14:04 GMT
"It's be a nice feature if the NumParas field had such switches, but since
there doesn't even seem to be a NumParas field, guess not."

Ok thanks, that is the kind of thing I was hoping for but I guess not :(

> Oh, I was thrown off by you saying you need to do it in code.
>
[quoted text clipped - 35 lines]
>>>>> the
>>>>> list.
Daiya Mitchell - 27 Feb 2005 18:02 GMT
But I bet a NumParas field is really easy in VBA.  Not so sure about
limiting it to certain styles, though I would find that feature really
useful as well.

> "It's be a nice feature if the NumParas field had such switches, but since
> there doesn't even seem to be a NumParas field, guess not."
>
> Ok thanks, that is the kind of thing I was hoping for but I guess not :(
G.G.Yagoda - 01 Mar 2005 01:14 GMT
Put a bookmarked named "ListCnt" where you want to display the list
count.  Then run this code:

Dim R As Range, ListCnt As Integer
Set R = ActiveDocument.Range
R.Start = R.End
Do
With R.Find
   .Style = "My Style"
   .Forward = False
   .Execute
   Select Case R.Find.Found
       Case True
           If R.ListFormat.ListType = 3 Or R.ListFormat.ListType = 4
Then
               ListCnt = R.ListFormat.ListValue
               Exit Do
           Else
               ListCnt = ListCnt + 1
               R.End = R.Start
           End If
       End Select
End With
Loop While R.Find.Found
Set R = ActiveDocument.Bookmarks("ListCnt").Range
R.Text = ListCnt
ActiveDocument.Bookmarks.Add Name:="ListCnt", Range:=R
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.