1

Trying to use the below VBA PowerPoint macro to create a text box, and format the 1st and 2nd bullet. I want the first bullet to be character 8226 (a bullet), but I want the 2nd bullet to be a "-". I haven't found any solution to format the 2nd bullet.

    For Each oSld In ActiveWindow.Selection.SlideRange
    Set shp = oSld.Shapes.AddShape(Type:=msoTextOrientationHorizontal, _
        Left:=482, Top:=195, Width:=500, Height:=50)
    shp.Fill.Visible = msoFalsee
    shp.TextFrame.TextRange.ParagraphFormat.Bullet.Visible = msoTrue
    shp.TextFrame.TextRange.ParagraphFormat.Bullet.RelativeSize = 1.15
    shp.TextFrame.TextRange.ParagraphFormat.Bullet.Font.Color = RGB(0, 0, 0)
    shp.TextFrame.TextRange.ParagraphFormat.Bullet.Character = 8226
Ken White
  • 123,280
  • 14
  • 225
  • 444
Dan
  • 21
  • 3
  • Record a macro that does what you want then take a look at the code. – freeflow Sep 26 '22 at 19:44
  • 1
    VBA is not the right tool for this job. Instead, edit the presentation XML to add up to 9 text level styles to text boxes. Here are my how-to articles: https://www.brandwares.com/bestpractices/2016/12/xml-hacking-text-box-styles/ https://www.brandwares.com/bestpractices/2016/12/xml-hacking-styled-text-boxes-complete/ – John Korchok Sep 26 '22 at 19:57
  • I need to use PPT VBA to add this shape in - that way it's completely uniform by whoever uses it. Cannot use PPT to record macros either (that function doesn't exist). – Dan Sep 26 '22 at 20:11
  • If you use VBA to add buttons, how will your users create new bullets in new text boxes? They would also need the VBA code, which would require that you distribute a macro-enabled template or an add-in. Adding bullets to the text box via XML is completely uniform (each text box will be identical), _and_ your users don't have to run any code. – John Korchok Sep 27 '22 at 16:32
  • Tried using your resources and it wasn't clear how to implement this. – Dan Sep 28 '22 at 17:30
  • @JohnKorchok I had a look at the link provided and I am very curios about this style feature. Would it be possible to have multiple formatting boxes? I mean, from the description, you say there are nine levels/styles, but could there be two/three/n boxes to multiply the available styles? – Oran G. Utan Nov 19 '22 at 19:01

1 Answers1

0

Please see below if this is what you meant, the character you are looking for should be 822 (I got it from here https://en.wikipedia.org/wiki/List_of_Unicode_characters)

Try also to have a look at this: https://gist.github.com/chriswhong/412f5de091691c6426768184a11a45e6

Sub bullets()
Dim oSld As PowerPoint.slide
Dim shp As PowerPoint.Shape

    For Each oSld In ActiveWindow.Selection.SlideRange
                Set shp = oSld.Shapes.AddShape(Type:=msoTextOrientationHorizontal, _
                    Left:=482, Top:=195, Width:=500, Height:=50)
            '    shp.Fill.Visible = msoFalse
                shp.TextFrame.TextRange.ParagraphFormat.Bullet.Visible = msoTrue
                shp.TextFrame.TextRange.ParagraphFormat.Bullet.RelativeSize = 1.15
                shp.TextFrame.TextRange.ParagraphFormat.Bullet.Font.Color = RGB(0, 0, 0)
                
                shp.TextFrame.TextRange.Paragraphs(1).Text = "1" & vbNewLine
                shp.TextFrame.TextRange.Paragraphs(1).IndentLevel = 1
                
                shp.TextFrame.TextRange.Paragraphs(1).ParagraphFormat.Bullet.Character = 8226
            '
                shp.TextFrame.TextRange.Paragraphs(2).Text = "2"
                shp.TextFrame.TextRange.Paragraphs(2).IndentLevel = 2
            
                shp.TextFrame.TextRange.Paragraphs(2).ParagraphFormat.Bullet.Character = 822

    Next oSld
End Sub



Oran G. Utan
  • 455
  • 1
  • 2
  • 10