|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Const wdFormatText = 17 '2:text;8:html;9:rtf;10:htm
Set fsObject = CreateObject ("Scripting.FileSystemObject")
myPptDir=fsObject.GetAbsolutePathName("")
If Not (fsObject.FolderExists(myPptDir)) Then
MsgBox myPptDir & "源文件夹不存在,程序终止。", vbCritical, "错误"
Wscript.Quit
End If
If InStrRev(myPptDir, "\") < Len(myPptDir) Then
myPptDir = myPptDir & "\"
End If
Set PptFilesDir = fsObject.Getfolder(myPptDir)
Set myPptFiles = PptFilesDir.Files
Set myObject = Wscript.CreateObject("Powerpoint.Application")
For Each PptFile In myPptFiles
If LCase(Right(PptFile.Name, 3)) = "ppt" Then
JPGFileName = myPptDir & Left(PptFile.Name,InStrRev (PptFile.Name, ".")) & "jpg"
Set Pres = myObject.Presentations.Open(pptFile.Path, False, False, False)'Open(FileName,ReadOnly,Untitled,WithWindow)
Pres.SaveAs JPGFileName, 17, False
End If
Next
MsgBox "Done!"
myObject.Quit
Set myObject = Nothing
以上代码可以将扩展名ppt的ppt批量转成jpg ,怎么修改代码支持pptx格式,谢谢
|
|