D
Dan
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
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