VBA - PowerPoint - 插入自定义项目符号
VBA - PowerPoint - Insert custom bullets
希望你一切顺利。我正在尝试创建一个代码以在选定的文本框中插入以下项目符号
使用的字体是Wingdings,字符是
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
我尝试使用以下代码:
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
但是 powerpoint returns 该代码有一个错误。
你有什么想法吗?
感谢您的宝贵时间
纳克索
而不是 ActiveSlide
,尝试以这种方式引用 "ActiveSlide":
Dim activeSlide as Slide
set activeSlide = Application.ActiveWindow.View.Slide
您应该在 幻灯片版式 而不是幻灯片上设置更改。否则,您必须在您创建的每张具有此编号样式的新幻灯片上重新运行宏。
但是您正在重新发明轮子,因为 PowerPoint 已经包含这种编号样式。在 XML 中,它被称为 circleNumWdBlackPlain。 (这是我关于 PowerPoint 编号样式的文章,更详细:OOXML Hacking: PowerPoint Numbering Styles
VBA设置为:
Sub NumberStyling()
With ActiveWindow.Selection.ShapeRange(1).TextFrame2.TextRange.ParagraphFormat.Bullet
.Type = msoBulletNumbered
.Style = msoBulletcircleNumWdBlackPlain
End With
End Sub
希望你一切顺利。我正在尝试创建一个代码以在选定的文本框中插入以下项目符号
使用的字体是Wingdings,字符是
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
我尝试使用以下代码:
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
但是 powerpoint returns 该代码有一个错误。 你有什么想法吗?
感谢您的宝贵时间 纳克索
而不是 ActiveSlide
,尝试以这种方式引用 "ActiveSlide":
Dim activeSlide as Slide
set activeSlide = Application.ActiveWindow.View.Slide
您应该在 幻灯片版式 而不是幻灯片上设置更改。否则,您必须在您创建的每张具有此编号样式的新幻灯片上重新运行宏。
但是您正在重新发明轮子,因为 PowerPoint 已经包含这种编号样式。在 XML 中,它被称为 circleNumWdBlackPlain。 (这是我关于 PowerPoint 编号样式的文章,更详细:OOXML Hacking: PowerPoint Numbering Styles
VBA设置为:
Sub NumberStyling()
With ActiveWindow.Selection.ShapeRange(1).TextFrame2.TextRange.ParagraphFormat.Bullet
.Type = msoBulletNumbered
.Style = msoBulletcircleNumWdBlackPlain
End With
End Sub