PowerPoint VBA:哪个命令(或一组命令)会从我的.jpg图片中创建ppt帧? [英] PowerPoint VBA: which command (or a set of commands) would create ppt frames out of my .jpg pictures?

查看:151
本文介绍了PowerPoint VBA:哪个命令(或一组命令)会从我的.jpg图片中创建ppt帧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C中有几个.jpg文件:\ my_folder

I have a few .jpg files in C:\my_folder

以下是他们的名字:pic_1.jpg,pic_2.jpg,pic_3.jpg,pic_4。 jpg,pic_5.jpg。

Here are their names: pic_1.jpg , pic_2.jpg , pic_3.jpg , pic_4.jpg , pic_5.jpg .

我应该使用Power Point VBA中的哪些命令或一组命令,以便能够在PowerPoint中自动创建多个帧,以便每个框架会包含一张图片吗?

What command or a group of commands in Power Point VBA should I use in order to be able to automatically create several frames in PowerPoint so that each frame would contain one picture?

推荐答案

此VBScript创建一个新的PowerPoint演示文稿,并为其添加两张幻灯片,每张幻灯片都有一张图片。您需要根据自己的喜好调整图片的位置和大小。如果您想自动获取目录中存在的任何图片以嵌入到演示文稿中,您还需要利用Scripting.FileScriptingObject来枚举您的图像。如果您希望脚本也可以在生成幻灯片后通过调用 pptPresentation.SaveAs 来保存演示文稿。

This VBScript creates a new PowerPoint presentation and adds two slides to it, each with a picture. You will need to adjust the picture's location and size to suit your taste. Also you'll need to utilize the Scripting.FileScriptingObject to enumerate your images if you want to automatically grab whatever pictures exist in a directory for embedding into the presentation. If you want your script can also save the presentation by calling pptPresentation.SaveAs after your slides are generated.

MSDN文档位于 http://msdn.microsoft.com/en-us/ library / ff746873.aspx

Dim pptDoc
Dim pptPresentation
Dim pptSlide

Set pptDoc = WScript.CreateObject( "PowerPoint.Application" )
pptDoc.Visible = True
Set pptPresentation = pptDoc.Presentations.Add( True )

' Add a new slide with a blank layout to the end of the Slides collection
' 12 = ppLayoutBlank
Set pptSlide = pptPresentation.Slides.Add( pptPresentation.Slides.Count + 1, 12 )

' Add a picture into the slide, saving the picture into the PowerPoint document
' 10, 10 are the Left and Top coordinates respectively
pptSlide.Shapes.AddPicture "c:\FullPath\1.JPG", False, True, 10, 10

' Add another slide with a picture
Set pptSlide = pptPresentation.Slides.Add( pptPresentation.Slides.Count + 1, 12 )
pptSlide.Shapes.AddPicture "c:\FullPath\2.jpg", False, True, 10, 10

这篇关于PowerPoint VBA:哪个命令(或一组命令)会从我的.jpg图片中创建ppt帧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆