所以我的问题是这样的:我想更改 250 多个演示文稿(文件)中文本形状的颜色。如果演示文稿处于活动状态并打开,我可以通过执行以下操作来执行此操作:
Sub ChangeShapeColor()
Dim oSh As Shape
Dim oSl As Slide
Dim prs As Presentation
For Each prs In Presentations
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
If oSh.Fill.ForeColor.RGB = RGB(84, 133, 192) Then
oSh.Fill.ForeColor.RGB = RGB(0, 51, 204)
oSh.Fill.Transparency = 0.4
End If
If oSh.Fill.ForeColor.RGB = RGB(202, 24, 24) Then
oSh.Fill.ForeColor.RGB = RGB(212, 10, 10)
oSh.Fill.Transparency = 0.4
End If
Next oSh
Next oSl
Next prs
End Sub
Run Code Online (Sandbox Code Playgroud)
然而,所有文件都存储在一个文件夹中,然后存储在更多子文件夹中。
我如何调整代码,使 vba 在循环中逐步打开特定文件夹 C://xyz/xyx/presentations 中的所有其他演示文稿,执行子程序并保存它? …