Consulting

Results 1 to 3 of 3

Thread: Bullet

  1. #1

    Bullet

    Can somebody help me with following

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

  2. #2
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    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:
    [vba]
    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
    [/vba]
    Office 2010, Windows 7
    goal: to learn the most efficient way

  3. #3
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    p.s. -- You have to have some text selected in a table, shape or textbox for it to work.
    Office 2010, Windows 7
    goal: to learn the most efficient way

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •