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 / December 2005

Tip: Looking for answers? Try searching our database.

Get the current number

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lin - 27 Dec 2005 11:41 GMT
Hello,

I've created an autonumber in my document and  now i want to know how can i
get the current number of the section that the user is standing on (with a
macro of course).

thanks - Lin
Stefan Blom - 28 Dec 2005 08:46 GMT
Getting information about the "current" numbering (from a certain
style) can be as easy as using a STYLEREF field; see Word Help for
more.

If you need a macro solution, there are several possibilities:

To get information about the number formatting of the *current*
paragraph, you can use the techniques presented at
http://word.mvps.org/faqs/numbering/ListString.htm.

You can apply the tips of that article to the current heading level by
using the "\headinglevel" bookmark. For example:

x = ActiveDocument.Bookmarks("\headinglevel") _
.Range.ListFormat.ListString

If you want to locate a *specific* heading level, though, a more
advanced approach is needed. One way would be the following: Starting
at the currently selected paragraph, you can use the Previous method
(Paragraph class) to loop backwards, paragraph by paragraph (without
changing the selection), until the desired heading level/numbering
level is found, and retrieve its numbering properties, as above.

I'm not sure if this is the only and/or best approach, though. If you
don't get a "more complete" answer here, you might want to ask in a
programming newsgroup instead.

Signature

Stefan Blom
Microsoft Word MVP

> Hello,
>
[quoted text clipped - 5 lines]
>
> thanks - Lin

Rate this thread:






 
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.