PDA

View Full Version : Bullet



marathi.bana
01-20-2009, 07:55 PM
Can somebody help me with following

I want to create a macro, to change the bullet indent as per the font size.

TrippyTom
01-20-2009, 09:31 PM
I had to do this very same thing in a previous project at work. I have attached a .zip file that has a sample slide and the code is inside the file as well.

For anyone curious, the code is below too:

Sub bMain()
On Error Resume Next
Dim myBody As Long
Dim bullets_main As Long
Dim bullets_pro As Long
Dim bullets_con As Long
Dim bullets_neutral As Long
Dim mySlide As Long
myBody = RGB(0, 0, 0) 'Black
bulletColor = RGB(0, 0, 255) 'Blue
mySlide = ActiveWindow.View.Slide.SlideIndex

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 .Font.Size
Case Is >= 11 '---- Normal indents
Select Case .IndentLevel
Case Is = 1
With .Application.ActiveWindow.Selection.TextRange.Paragraphs(i)
.ParagraphFormat.Alignment = ppAlignLeft
.Parent.Ruler.Levels(i).FirstMargin = 0
.Parent.Ruler.Levels(i).LeftMargin = 18
End With
Case Is = 2
With .Application.ActiveWindow.Selection.TextRange.Paragraphs(i)
.ParagraphFormat.Alignment = ppAlignLeft
.Parent.Ruler.Levels(i).FirstMargin = 18
.Parent.Ruler.Levels(i).LeftMargin = 36
End With
Case Is = 3
With .Application.ActiveWindow.Selection.TextRange.Paragraphs(i)
.ParagraphFormat.Alignment = ppAlignLeft
.Parent.Ruler.Levels(i).FirstMargin = 36
.Parent.Ruler.Levels(i).LeftMargin = 54
End With
End Select
Case Is < 11 '---- Smaller indents
Select Case .IndentLevel
Case Is = 1
With .Application.ActiveWindow.Selection.TextRange.Paragraphs(i)
.ParagraphFormat.Alignment = ppAlignLeft
.Parent.Ruler.Levels(1).FirstMargin = 0
.Parent.Ruler.Levels(1).LeftMargin = 13.5
End With
Case Is = 2
With .Application.ActiveWindow.Selection.TextRange.Paragraphs(i)
.ParagraphFormat.Alignment = ppAlignLeft
.Parent.Ruler.Levels(2).FirstMargin = 13.5
.Parent.Ruler.Levels(2).LeftMargin = 27
End With
Case Is = 3
With .Application.ActiveWindow.Selection.TextRange.Paragraphs(i)
.ParagraphFormat.Alignment = ppAlignLeft
.Parent.Ruler.Levels(3).FirstMargin = 27
.Parent.Ruler.Levels(3).LeftMargin = 40.5
End With
End Select
End Select
End With
Next i
For i = 1 To .TextRange.Paragraphs.Count
With .TextRange.Paragraphs(Start:=i, Length:=1)
Select Case .IndentLevel
Case Is = 1
With .ParagraphFormat.Bullet
.Visible = msoCTrue
With .Font
.Name = "Wingdings 2"
.Color.RGB = bulletColor
End With
.Character = 151
End With
Case Is = 2
With .ParagraphFormat.Bullet
.Visible = msoCTrue
With .Font
.Name = "Arial"
.Color.RGB = bulletColor
End With
.Character = 8211
End With
Case Is = 3
With .ParagraphFormat.Bullet
.Visible = msoCTrue
With .Font
.Name = "Wingdings"
.Color.RGB = bulletColor
End With
.Character = 167
.RelativeSize = 0.9
End With
End Select
End With
Next i
End If
End With
End Sub

TrippyTom
01-20-2009, 09:32 PM
p.s. -- You have to have some text selected in a table, shape or textbox for it to work.