Reputation: 51
I hope you are doing well. I am trying to create a code to insert the following bullets within the selected text box
The font used is Wingdings and the characters are
I tried with the following code :
Sub bulletlist()
With ActiveSlide.Shapes(1).TextFrame.TextRange.ParagraphFormat.bullet
.Type = ppBulletUnnumbered
.Character = 140
With .Font
.Name = "Wingdings"
.Size = 44
.Color = RGB(255, 255, 255)
End With
End With
With ActiveSlide.Shapes(1).TextFrame.TextRange.ParagraphFormat.bullet
.Type = ppBulletUnnumbered
.Character = 141
With .Font
.Name = "Wingdings"
.Size = 44
.Color = RGB(255, 255, 255)
End With
End With
With ActiveSlide.Shapes(1).TextFrame.TextRange.ParagraphFormat.bullet
.Type = ppBulletUnnumbered
.Character = 142
With .Font
.Name = "Wingdings"
.Size = 44
.Color = RGB(255, 255, 255)
End With
End With
With ActiveSlide.Shapes(1).TextFrame.TextRange.ParagraphFormat.bullet
.Type = ppBulletUnnumbered
.Character = 143
With .Font
.Name = "Wingdings"
.Size = 44
.Color = RGB(255, 255, 255)
End With
End With
End Sub
But powerpoint returns an error on that code. Do you have any ideas?
Thank you for your time Naxso
Upvotes: 0
Views: 1439
Reputation: 4923
You should be setting changes on the slide layout, not the slide. Otherwise, you'll have to rerun the macro on every new slide you create that has this numbering style.
But you're reinventing the wheel, because PowerPoint already includes this numbering style. In the XML, it's called circleNumWdBlackPlain. (Here's my article on PowerPoint numbering styles, with more detail: OOXML Hacking: PowerPoint Numbering Styles
The VBA to set this:
Sub NumberStyling()
With ActiveWindow.Selection.ShapeRange(1).TextFrame2.TextRange.ParagraphFormat.Bullet
.Type = msoBulletNumbered
.Style = msoBulletcircleNumWdBlackPlain
End With
End Sub
Upvotes: 2
Reputation: 43593
Instead of ActiveSlide
, try to refer to the "ActiveSlide" this way:
Dim activeSlide as Slide
set activeSlide = Application.ActiveWindow.View.Slide
Upvotes: 1