Hello Again!

I seem to be misunderstanding ActiveDocument.Lists and ranges and once
again need some help.

What I am trying to do is find every line in a document that has a
bullet.

I then want to look at the style used for each line with a bullet.
(There should only be 5 styles ever used). Based on the style used, I
want to assign a different style. However, with the code I have, it is
changing all of the lines between the first bullet list and the last
bullet list in the document.

So I'm thinking I'm close, I'm just not defining my ranges correctly.
But I'm not sure what I need to change.

As always, any help will be greatly appreciated!

Dan
--
The code is:

Sub ChangeBulletStyles()
Dim oList As List
Dim opara As Paragraph
Dim oRng As Range

For Each oList In ActiveDocument.Lists
For Each opara In oList.Range.Paragraphs
Set oRng = opara.Range
If oRng.style = "Para 1.1" Then oRng.style = "List Bullet 2"
Else
If oRng.style = "Para 1.1.1" Then oRng.style = "List Bullet 3"
Else
If oRng.style = "Para 1.1.1.1" Then oRng.style = "List Bullet
4" Else
If oRng.style = "Para 1.1.1.1.1" Then oRng.style = "List Bullet
5" Else
If oRng.style = "Normal" Then oRng.style = "List Bullet"
Next opara
Next oList
End Sub

Re: Changing Styles of Bulleted Lists (Word 2000/Windows) by Vince

Vince
Wed Feb 02 02:33:04 CST 2005

Dan,

This might work. I have not tested it, but you may want to give it a shot
for whatever it's worth.

Dim i As Integer

For i = 1 To ActiveDocument.Paragraphs.Count - 1

ActiveDocument.Paragraphs(i).Range.Select

If Selection.Range.ListParagraphs.Count = 1 Then

if selection.range.listformat.listlevelnumber>=1 then
' We have a bullet or any other word autonumbering (like a list)
if selection.style = "Original Style" then selection.style =
"New Style"
' So forth....
endif
End If
Next


"Dan" <YEIREZQVBHEY@spammotel.com> wrote in message
news:1107296274.854857.77340@z14g2000cwz.googlegroups.com...
> Hello Again!
>
> I seem to be misunderstanding ActiveDocument.Lists and ranges and once
> again need some help.
>
> What I am trying to do is find every line in a document that has a
> bullet.
>
> I then want to look at the style used for each line with a bullet.
> (There should only be 5 styles ever used). Based on the style used, I
> want to assign a different style. However, with the code I have, it is
> changing all of the lines between the first bullet list and the last
> bullet list in the document.
>
> So I'm thinking I'm close, I'm just not defining my ranges correctly.
> But I'm not sure what I need to change.
>
> As always, any help will be greatly appreciated!
>
> Dan
> --
> The code is:
>
> Sub ChangeBulletStyles()
> Dim oList As List
> Dim opara As Paragraph
> Dim oRng As Range
>
> For Each oList In ActiveDocument.Lists
> For Each opara In oList.Range.Paragraphs
> Set oRng = opara.Range
> If oRng.style = "Para 1.1" Then oRng.style = "List Bullet 2"
> Else
> If oRng.style = "Para 1.1.1" Then oRng.style = "List Bullet 3"
> Else
> If oRng.style = "Para 1.1.1.1" Then oRng.style = "List Bullet
> 4" Else
> If oRng.style = "Para 1.1.1.1.1" Then oRng.style = "List Bullet
> 5" Else
> If oRng.style = "Normal" Then oRng.style = "List Bullet"
> Next opara
> Next oList
> End Sub
>



Re: Changing Styles of Bulleted Lists (Word 2000/Windows) by Dan

Dan
Wed Feb 02 08:31:56 CST 2005

Vince,

I will give that a try. Thank you!!