How to search all numbered paragraphs regardless style

A

Artur

Hi all,

I'm sorry, asking such basic question but the issue seems tricky for me.

Most of users do not use styles wisely, they use buttons. Unfortunatelly,
applying automatic paragraph numbering (listing) via buttons does not keep
specyfic styles.

How can I search/mark/extract/cut paragraphs (just set range on them) using
VBA (MS Word XP) JUST USING THE FACT THAT THEY ARE NUMBERED (or listed by
bullets), regardless their style name.

Thanx in advance,

Artur
 
B

Bruce Brown

Your message is not specific enough. What exactly do you want to do?
And which numbering styles are you using?
 
B

Bruce Brown

Artur

Maybe this is what you're looking for. It stops only for numbered
paragraphs, skipping unnumbered and bulleted paragraphs. It selects
the paragraph, tells you what kind of numbering it is and what the
paragraph style is, then asks if you want to stop there. A little
sloppy but it works.

Sub ShowNumberedParasOnly()
Dim P As Paragraph, Ans As Byte
ActiveWindow.ActivePane.View.ShowFieldCodes = True
For Each P In ActiveDocument.Paragraphs
P.Range.Select
Select Case P.Range.ListFormat.ListType
Case Is = 1
Ans = MsgBox("Numbering type = Field numbering" & vbCr & _
"Style = " & Selection.Style.NameLocal, vbYesNo, "Stop?")
If Ans = 6 Then Exit Sub
Case Is = 3
Ans = MsgBox("Numbering type = Simple list" & vbCr & _
"Style = " & Selection.Style.NameLocal, vbYesNo, "Stop?")
If Ans = 6 Then Exit Sub
Case Is = 4
Ans = MsgBox("Numbering type = Outline numbering" & vbCr & _
"Style = " & Selection.Style.NameLocal, vbYesNo, "Stop?")
If Ans = 6 Then Exit Sub
Case Is = 5
Ans = MsgBox("Numbering type = Mixed numbering" & vbCr & _
"Style = " & Selection.Style.NameLocal, vbYesNo, "Stop?")
If Ans = 6 Then Exit Sub
End Select
Next
End Sub
 

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

Top