当前位置:首页经验技巧Ppt经验ppt幻灯

如何将多张图片制作成一个PowerPoint幻灯片?每个幻灯片放一个图片

2024-07-25 10:12:45

1.如何将多张图片制作成一个PPT?每个幻灯片放一个图片

这个可以用VBS来做。如下步骤可自动将某个文件夹下面的JPG图片按照每个图片一张幻灯片的形式生成一个PPT文件。

1、创建并保存一个VBS文件(比如“批量导入图片.vbs”)包含如下代码:

Option Explicit

Const strRootPath = "D:\Downloads\Pictures\"

Dim oApplication, oPresentation, oShape, fso, oFolder, oFile, oLayout, oSlide

Set oApplication = CreateObject("PowerPoint.Application")

oApplication.Visible = True

Set oPresentation = oApplication.Presentations.Add()

Set fso = CreateObject("Scripting.FileSystemObject")

Set oFolder = fso.GetFolder(strRootPath)

For Each oFile In oFolder.Files

If LCase(fso.GetExtensionName(oFile.Path)) = "jpg" Then

Set oSlide = oPresentation.Slides.AddSlide(oPresentation.Slides.Count + 1, oPresentation.SlideMaster.CustomLayouts(1))

Set oShape = oSlide.Shapes.AddPicture(oFile.Path, 0, -1, 0, 0)

If oShape.Width < oPresentation.PageSetup.SlideWidth Then oShape.Left = (oPresentation.PageSetup.SlideWidth - oShape.Width) / 2

If oShape.Height < oPresentation.PageSetup.SlideHeight Then oShape.Top = (oPresentation.PageSetup.SlideHeight - oShape.Height) / 2

End If

Next

Set fso = Nothing

Set oFolder = Nothing

Set oSlide = Nothing

Set oLayout = Nothing

Set oShape = Nothing

Set oPresentation = Nothing

2、修改其中的图片文件夹路径为你存放图片的目录;

3、在资源管理器中双击这个vbs文件,PowerPoint将自动打开并把所有图片导入成一幅图片一张幻灯片。


电脑版

免责声明:本站信息来自网络收集及网友投稿,仅供参考,如果有错误请反馈给我们更正,对文中内容的真实性和完整性本站不提供任何保证,不承但任何责任,谢谢您的合作。
版权所有:五学知识网 Copyright © 2015-2024 All Rights Reserved .