PDA

View Full Version : [SOLVED] VBA format indent level in text



TrippyTom
07-05-2007, 04:45 PM
Does anyone know the correct syntax to format indent levels on bullets? For instance, I want:
Bullet 1 = 0 with hanging indent of 0.25
Bullet 2 = 0.25 with hanging indent of 0.50
Bullet 3 = 0.50 with hanging indent of 0.75

How can I do this with VBA?

TrippyTom
07-05-2007, 05:43 PM
Nevermind, I figured it out. :)

TrippyTom
07-09-2007, 02:04 PM
In case anyone wanted to know the answer, here's a sample of how it would be done. It only works with selected text (not a selected text box) because that's how I programmed it.


With Application.ActiveWindow.Selection
If .Type = ppSelectionText Then
i = 1
For i = 1 To .TextRange.Paragraphs.Count
With .TextRange.Paragraphs(Start:=i, Length:=1)
Select Case .IndentLevel
Case Is = 1
.ParagraphFormat.Alignment = ppAlignLeft
.Parent.Ruler.Levels(i).FirstMargin = 0
.Parent.Ruler.Levels(i).LeftMargin = 18
With .ParagraphFormat.Bullet
.Visible = msoCTrue
With .Font
.Name = "Arial"
.Color.RGB = bullets_pro
End With
.Character = 9650
End With
Case Is = 2
.ParagraphFormat.Alignment = ppAlignLeft
.Parent.Ruler.Levels(i).FirstMargin = 18
.Parent.Ruler.Levels(i).LeftMargin = 36
With .ParagraphFormat.Bullet
.Visible = msoCTrue
With .Font
.Name = "Arial"
.Color.RGB = bullets_pro
End With
.Character = 8211
End With
Case Is = 3
.ParagraphFormat.Alignment = ppAlignLeft
.Parent.Ruler.Levels(i).FirstMargin = 36
.Parent.Ruler.Levels(i).LeftMargin = 54
With .ParagraphFormat.Bullet
.Visible = msoCTrue
With .Font
.Name = "Wingdings"
.Color.RGB = bullets_pro
End With
.Character = 167
.RelativeSize = 0.9
End With
End Select
End With
Next I
End If
End With