PowerPoint中的VBA:ColorIndex改变文字颜色?

问题描述 投票:0回答:1

我正在使用VBA将数据从Excel粘贴到PowerPoint演示文稿中。现在我添加了一个文本框,想要更改其中文本的颜色。它在使用“vbBlack”或RGB时有效

myPresentation.Slides(1).Shapes(1).TextFrame.TextRange.Font.Color = vbBlack

myPresentation.Slides(1).Shapes(1).TextFrame.TextRange.Font.Color = RGB(255, 0, 0)

但是,我可以使用ColorIndex吗?当我尝试它说它不认识这种方法。

vba powerpoint
1个回答
1
投票

Powerpoint不包括ColorIndex中的ColorFormat属性。但是,它确实包括ColorConstants enum

你也可以使用SchemeColorObjectThemeColor

您需要将单元格设置为ColorIndex,然后检索Color以获取RGB值。

© www.soinside.com 2019 - 2024. All rights reserved.