Section in the bullet and numbering

  • Thread starter Thread starter associates76
  • Start date Start date
A

associates76

Hi,

I wonder if i can get some helps here. In the bullets and numbering, we
can choose the one with the number format "Section 1.".

My question here is whether there is a way to capture the number "1"
using VBA codes.

For example, if we're at Section 3. , the code will return 3.

I have tried to use the following code but to no avail.

Selection.Collapse Direction:=wdCollapseStart
MsgBox "The insertion point is in section " & _
Selection.Information(wdActiveEndSectionNumber)

It looks like it returns the page number.

I use office word 03.

Thank you in advance
 
Hi Stefan,

Thank you for your reply.

From what i can understand from the article, it's not possible to keep
track of the numbering system in the outline numbering. I tested it by
using the following code

MsgBox Selection.Paragraphs(1).OutlineLevel --> this actually returns
the level number

and if i have the following

Section 1. Some texts --> it returns 1

1.1. Some texts --> it returns 2
some texts --> it returns 10
1.1.1. Some texts --> it returns 3


Whereas what i'm after is
Section 1. Some texts --> returns 1
Section 2. Some texts --> returns 2
and so on

I suppose what i really wanted done is not doable :(

Is there any better ways i can use to achieve my goal here? any
suggestions?

Thank you in advance
 
Use the ListValue property to get the number assigned to a list item. For
example, consider the following list:

Article I. Paragraph text here.
Article II. Paragraph text here.

When the insertion point is inside the second item, the following code:

Debug.Print Selection.Range.ListFormat.ListValue

would print 2 (to the Immediate window of the Visual Basic Editor).

--
Stefan Blom
Microsoft Word MVP


in message
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top