vba 如何在vba powerpoint中仅更改线条形状颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22608556/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change only line shape color in vba powerpoint
提问by Irakli Andguladze
I have task to make colour fill in Powerpoint VBA. When I select lines and boxes I want to change lines only and leave the boxes colour. Is there a way to change only private shapes?
我的任务是在 Powerpoint VBA 中进行颜色填充。当我选择线条和框时,我只想更改线条并保留框的颜色。有没有办法只改变私人形状?
回答by Gareth
The below code will change all the line colours in slide 2 to red in Powerpoint 2007:
下面的代码将在 PowerPoint 2007 中将幻灯片 2 中的所有线条颜色更改为红色:
Public Sub ChangeLineColours()
Dim shp As Shape
For Each shp In ActivePresentation.Slides(2).Shapes '<~~ Change '2' to whichever slide you want to loop through
If shp.Type = msoLine Then
shp.Line.ForeColor.RGB = RGB(255, 0, 0)
End If
Next shp
End Sub