通过嵌入 Excel 模板的文件以编程方式将图片设置为 powerpoint 背景

发布于 2024-11-27 14:40:40 字数 199 浏览 2 评论 0原文

我正在通过 Excel 中的 vba 生成 PPT 演示文稿,一切正常,除了我被要求自动设置电源点的背景(这不会有太大问题),但这将通过一张图片来完成实际上嵌入在宏中,所以我没有物理路径来引用图片,而且Excel是根据用户输入动态生成的。

那么..有没有人实现了这一点:以编程方式从 vba excel 设置幻灯片背景,并将图片嵌入到工作表中?

谢谢!

I'm generating a PPT presentation through vba in excel, everything is working just fine except that Im being asked to automatically set background of the power point (which it wouldn't be much a problem) but this will be done with a picture that is actually embedded on the macro, so I dont have physical path to reference the picture, plus the excel is generated on the fly according to the user inputs.

so.. has anyone achieved this : Programmatically set a slide backrground from vba excel with a picture that is embedded on a sheet?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

玻璃人 2024-12-04 14:40:40

据我了解,您想要在 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

As far as i understand, you want to set the background of the slides in vba (it doesn't matter it is called from Excel).

Let's assume you have the path in a 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

You will also have to adapt ActivePresentation with the PPT object you built from your previous code.

哀由 2024-12-04 14:40:40

如果您找不到直接从内存中的图片设置背景的方法,可以将图片从 Excel 复制/粘贴到 PPT 演示文稿中的幻灯片母版中,然后将它们发送到后面,以便它们位于所有内容的后面。我认为,从用户的角度来看,效果几乎是相同的。

If you can't find a way to set the background directly from a picture in memory, what about copy/pasting the picture from Excel into the Slide Master(s) in your PPT presentation then sending them to the back so they sit behind everything. The effect would be nearly identical from the user's point of view, I think.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文