Consulting

Results 1 to 2 of 2

Thread: Powerpoint table bullets

  1. #1
    VBAX Regular
    Joined
    Dec 2018
    Posts
    24
    Location

    Powerpoint table bullets

    Hello John. From a closed thread I took the below code, but I fail to make it work for selected text in tables (I renamed the Sub). For example, it works fine in text boxes, for selected (highlighted) text. I would be nice to have this feature work in tables. Happy New Year


    Sub TableBullets()
    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 = 15
    With .ParagraphFormat.Bullet
    .visible = msoCTrue
    With .Font
    .Name = "Wingdings"
    .Color.RGB = RGB(0, 0, 0)
    End With
    .Character = 167
    End With
    Case Is = 2
    .ParagraphFormat.Alignment = ppAlignLeft
    .Parent.Ruler.Levels(I).FirstMargin = 16
    .Parent.Ruler.Levels(I).LeftMargin = 31
    With .ParagraphFormat.Bullet
    .visible = msoCTrue
    With .Font
    .Name = "Arial"
    .Color.RGB = RGB(0, 0, 0)
    End With
    .Character = 8211
    End With
    Case Is = 3
    .ParagraphFormat.Alignment = ppAlignLeft
    .Parent.Ruler.Levels(I).FirstMargin = 32
    .Parent.Ruler.Levels(I).LeftMargin = 47
    With .ParagraphFormat.Bullet
    .visible = msoCTrue
    With .Font
    .Name = "Wingdings"
    .Color.RGB = RGB(0, 0, 0)
    End With
    .Character = 167
    .RelativeSize = 0.9
    End With
    End Select
    End With
    Next I
    End If
    End With
    End Sub

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    This is Legacy code from v. 2003.

    Starting with v.2007 the new Textrange2 object should be used together with LeftIndent and FirstLine Indent NOT Ruler and Left/First margins

    People often use the old code because there are plenty of examples out there, it's easier to understand and as long as it's a simple use (eg a textbox) it still works (sort of). You should use the new TextRange2 object with modern versions.

    Tables are not a simple use.

    This is the updated code and will work in textboxes too.

    Sub TableBullets()
    Dim I As Integer
    With Application.ActiveWindow.Selection
    If .Type = ppSelectionText Then
    I = 1
    For I = 1 To .TextRange2.Paragraphs.Count
    With .TextRange2.Paragraphs(I)
    Select Case .ParagraphFormat.IndentLevel
    Case Is = 1
    .ParagraphFormat.Alignment = ppAlignLeft
    'NOTE The FirstLineIndent is essentially how far Behind the
    'left indent the bullet appears. Usually it stays constant
    ' hard to understand at first
    .ParagraphFormat.FirstLineIndent = -15
    .ParagraphFormat.LeftIndent = 15
    With .ParagraphFormat.Bullet
    .Visible = msoCTrue
    With .Font
    .Name = "Wingdings"
    .Fill.ForeColor.RGB = RGB(0, 0, 0)
    End With
    .Character = 167
    End With
    Case Is = 2
    .ParagraphFormat.Alignment = ppAlignLeft
    .ParagraphFormat.FirstLineIndent = -15
    .ParagraphFormat.LeftIndent = 30
    With .ParagraphFormat.Bullet
    .Visible = msoCTrue
    With .Font
    .Name = "Arial"
    .Fill.ForeColor.RGB = RGB(0, 0, 0)
    End With
    .Character = 8211
    End With
    Case Is = 3
    .ParagraphFormat.Alignment = ppAlignLeft
    .ParagraphFormat.FirstLineIndent = -15
    .ParagraphFormat.LeftIndent = 45
    With .ParagraphFormat.Bullet
    .Visible = msoCTrue
    With .Font
    .Name = "Wingdings"
    .Fill.ForeColor.RGB = RGB(0, 0, 0)
    End With
    .Character = 167
    .RelativeSize = 0.9
    End With
    End Select
    End With
    Next I
    End If
    End With
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Tags for this Thread

Posting Permissions

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