'Bullets and indents not giving expected results
I'm trying to standardize the format the bullets of individual shapes but am not getting the results I want. The code is below.
The results I'm looking for are for the first level to have no bullet or indent and the rest of the bullets to be slightly indented from the start of the text of the previous level and the shapes alternating between dot and dash.
I've spent a couple of hours researching but haven't made any advances except to learn that I shouldn't use rulers. I don't understand what I should use instead for the indenting.
When I apply them to an existing shape, nothing works out as planned. I also can't get them to update automatically and have to go to the paragraph/bullet button on the ribbon for it to take efect.
Thanks in advance for your help.
Option Explicit
Global Const emDefaultStyleSpaceWithin = 0.9
Global Const emDefaultStyleSpaceBefore = 0.4
Global Const emDefaultStyleSpaceAfter = 0
Public Sub SetParagraphFormat()
Dim oParagraphFormat As ParagraphFormat
Dim Level As Single
Set oParagraphFormat = ActiveWindow.Selection.textRange.ParagraphFormat
With oParagraphFormat
' Set line spacing
If emDefaultStyleSpaceWithin Then
.LineRuleWithin = msoTrue
.SpaceWithin = emDefaultStyleSpaceWithin
Else
.SpaceWithin = 0
End If
If emDefaultStyleSpaceBefore Then
.LineRuleBefore = msoTrue
.SpaceBefore = emDefaultStyleSpaceBefore
Else
.SpaceBefore = 0
End If
.LineRuleAfter = msoTrue
.SpaceAfter = 0
' Set bullet format
.Bullet.RelativeSize = 1
For Level = 1 To 5
Select Case Level
Case 1
.Bullet.font.Name = "Arial"
.Bullet.Character = 8226
.Bullet.Visible = msoFalse
Case 2
.Bullet.font.Name = "Arial"
.Bullet.Character = 8226
Case 3
.Bullet.font.Name = "Arial"
.Bullet.Character = 8211
Case 4
.Bullet.font.Name = "Arial"
.Bullet.Character = 8226
Case 5
.Bullet.font.Name = "Arial"
.Bullet.Character = 8211
End Select
Next Level
End With
With ActiveWindow.Selection.ShapeRange.textFrame.Ruler
With .Levels(1)
.FirstMargin = 0
.LeftMargin = 0
End With
With .Levels(2)
.FirstMargin = 3
.LeftMargin = 17
End With
With .Levels(3)
.FirstMargin = 20
.LeftMargin = 30
End With
With .Levels(4)
.FirstMargin = 33
.LeftMargin = 45
End With
With .Levels(5)
.FirstMargin = 48
.LeftMargin = 51
End With
End With
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
