如何使用 VBA 在 PowerPoint 中将幻灯片复制和粘贴为图片?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4699270/
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 can I copy and paste slides as a picture in PowerPoint using VBA?
提问by ilios86
I want to cut one slide and paste it as a picture in same presentation file (ppt format).
我想剪切一张幻灯片并将其作为图片粘贴到同一个演示文件(ppt 格式)中。
I know that following VBA code work for copy&paste in a single slide.
我知道遵循 VBA 代码可以在一张幻灯片中复制和粘贴。
ActivePresentation.Slides(1).Copy ''copy first slide into clipboard
ActivePresentation.Slides.Paste ''paste above slide as a last slide
What I want to know is how to paste a slide as a "picture". ('paste as a picture' is an option of Paste Special [e.g. paste as a PNG,JPEG...])
我想知道的是如何将幻灯片粘贴为“图片”。(“粘贴为图片”是“选择性粘贴”的一个选项[例如粘贴为 PNG、JPEG...])
Are there any suggestions for how to go about this?
有没有关于如何解决这个问题的建议?
采纳答案by Todd Main
Yeah, your code was pretty close. Here's an example of taking Slide 1 and pasting it as a picture in Slide 2.
是的,你的代码非常接近。这是拍摄幻灯片 1 并将其粘贴为幻灯片 2 中的图片的示例。
ActivePresentation.Slides(1).Copy
ActivePresentation.Slides(2).Shapes.PasteSpecial ppPasteJPG
You can look up PpPasteDataType
for more formats to paste to.
您可以查找PpPasteDataType
要粘贴到的更多格式。