我正在通过 Excel 中的 vba 生成 PPT 演示文稿,一切正常,除了我被要求自动设置电源点的背景(这不会有太大问题),但这将通过以下方式完成实际上嵌入在宏中的图片,因此我没有物理路径来引用该图片,而且 Excel 是根据用户输入动态生成的。
所以..有没有人实现了这一点:以编程方式从 vba excel 设置幻灯片背景并嵌入在工作表上的图片?
谢谢!
最佳答案
据我了解,您想要在 vba 中设置幻灯片的背景(从 Excel 调用并不重要)。
假设您在 var 中有路径:
Dim osld As Slide
Set osld = ActivePresentation.Slides.Range 'every slides of the presentation
'This is important in some cases
osld.FollowMasterBackground = False
With osld.Background.Fill
.UserPicture <string var containing path to image>
End With
End Sub
您还必须使用您以前的代码构建的 PPT 对象来调整 ActivePresentation
。
关于vba - 通过嵌入 Excel 模板的文件以编程方式将图片设置为 powerpoint 背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6902181/