vba - 使用 VBA 识别和更改 PowerPoint 中的子弹类型
问题描述
我试图弄清楚如何识别子弹类型并进行更改,即检查整个演示文稿中使用的子弹是否是方形子弹。如果没有,宏应该将项目符号类型更改为方形。
示例:在这张图片中,我想在整个幻灯片中将圆形子弹更改为方形子弹。
解决方案
如果项目符号仅使用本地格式创建,则其他 2 个回复就足够了。如果演示文稿是普通的演示文稿,其中项目符号设置在幻灯片母版中,那些圆形项目符号将像难闻的气味一样不断回来。相反,将幻灯片母版上的项目符号更改为方形,然后重置所有幻灯片以强制更新。这将级别 1、3 和 5 设置为方形项目符号:
Sub ChangeSomeBullets()
Dim oSlide As Slide
Dim oShape As Shape
For Each oShape In ActivePresentation.Designs(1).SlideMaster.Shapes
If oShape.Type = msoPlaceholder Then
If oShape.PlaceholderFormat.Type = ppPlaceholderBody Then
For X = 1 To oShape.TextFrame2.TextRange.Paragraphs.Count
Select Case X
Case 1, 3, 5
With oShape.TextFrame2.TextRange.Paragraphs(X).ParagraphFormat.Bullet
.Font.Name = "Wingdings"
.Character = 167
End With
End Select
Next X
End If
End If
Next oShape
For Each oSlide In ActivePresentation.Slides
oSlide.CustomLayout = oSlide.CustomLayout
Next oSlide
End Sub
推荐阅读
- python - Python 与 Spyder
- html - 我只想在我的 html 页面中插入图片?
- javascript - 有条件的 onclick 函数在没有点击的情况下触发?
- sql - SQL Server - 即使不满足条件,也会显示 LEFT 表中的所有行
- android - 我的错误“意外元素
在发现 “,怎么解决? - c# - 将 blazor 应用程序托管到 Windows 服务器时,如何解决以下问题?
- javascript - 这个排序数组跳过一些元素有什么问题?
- android - “android:configChanges”有什么作用?
- javascript - ..Use state error: Too many re-renders React 限制渲染次数以防止无限循环
- razor - Razor 页面:带参数的 RedirectToPage