我正在嘗試關閉 PowerPoint 檔案(包括組和子組)中所有形狀的漸變填充。
問題是我什至不能正確地回圈遍歷這些形狀
Sub solid()
Set myDocument = ActivePresentation.Slides(1)
For Each sh In myDocument.Shapes
sh.Fill.solid
Next
End Sub
謝謝你的幫助。
uj5u.com熱心網友回復:
Sub solid()
Dim mydocument As Presentation
Set mydocument = ActivePresentation
Dim sh As Shape
Dim sl As Slide
For Each sl In mydocument.Slides
For Each sh In sl.Shapes
If HasGradient(sh) = True Then
sh.Fill.solid
End If
Next
Next
End Sub
并且還從 TheSpreadSheetGuru 中實作了這個函式來檢查形狀是否具有漸變值。
Function HasGradient(shp As Shape) As Boolean
'PURPOSE: Determine if a shape object contains a gradient format property
'SOURCE: www.TheSpreadsheetGuru.com/the-code-vault
Dim GradientStopCount As Long
'Test for Gradient Stops
On Error Resume Next
GradientStopCount = shp.Fill.GradientStops.Count
On Error GoTo 0
'Results
If GradientStopCount <> 0 Then
HasGradient = True
Else
HasGradient = False
End If
End Function
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/534683.html
標籤:VBA微软幻灯片软件
上一篇:我想在此代碼的正文中添加“CC”和文本。我應該怎么做才能添加它?
下一篇:帶階乘的VBASigma公式
