本帖最后由 老刘1号 于 2017-7-22 12:25 编辑
纠结了很久到底是发第三方区还是VBS原创代码区……
算了,就发这里吧。
工具名:PPT转JPEG图片小工具
英译:Powerpoint document to JPEG image files tool~
用法:将单或多个ppt文件拖到vbs上,等待一会即可。会在ppt文件目录下生成同名文件夹,里面就是图片,并且已经排好了序。
Usage: Pull the Powerpoint document(s) above the Vbscript file,then wait a moment.This application will create a folder that name same as the Powerpoint documents and in same path of it, inside of the folder are sort format JPEG images.
环境:office2007或更高,wps2013或更高。
Environment: Office 2007 or higher,WPS 2013 or higher. PPT2JPEG.VBS源代码(Source):- Option Explicit
- If WScript.Arguments.Count > 0 Then
- Dim oPPT,oPPTFile,[幻灯片],[计数器],fso,Arg
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set oPPT = CreateObject("PowerPoint.Application")
- Dim PPTFilePath,PPTFileBaseName
- For Each Arg In WScript.Arguments
- If fso.FileExists(Arg) And _
- (UCase(fso.GetExtensionName(Arg)) = "PPT" Or UCase(fso.GetExtensionName(Arg)) = "PPTX") Then
-
- With fso
- PPTFilePath = .GetParentFolderName(Arg)
- PPTFileBaseName = .GetBaseName(Arg)
- End With
-
- If Not fso.FolderExists(PPTFilePath&"\"&PPTFileBaseName) Then
- fso.GetFolder(PPTFilePath).SubFolders.Add PPTFileBaseName
- End If
-
- Set oPPTFile = oPPT.Presentations.Open(Arg)
- [计数器] = 0
- For Each [幻灯片] In oPPTFile.Slides
- [计数器] = [计数器] + 1
- [幻灯片].Export PPTFilePath&"\"&PPTFileBaseName&"\"&PPTFileBaseName&" ("&[计数器]&").JPG","JPG"
- Next
- oPPTFile.Close
- Set oPPTFile = Nothing
- End If
- Next
- oPPT.Quit
- Set oPPT = Nothing
- Else
- MsgBox "请将文件拖到程序上~",,"【老刘制作】PPT转图片"
- End If fso.GetFolder(PPTFilePath).SubFolders.Add PPTFileBaseName
- End If
-
- Set oPPTFile = oPPT.Presentations.Open(WScript.Arguments(0))
- [计数器] = 0
- For Each [幻灯片] In oPPTFile.Slides
- [计数器] = [计数器] + 1
- [幻灯片].Export PPTFilePath&"\"&PPTFileBaseName&"\"&PPTFileBaseName&" ("&[计数器]&")."&"JPG","JPG"
- Next
- oPPTFile.Close
- Set oPPTFile = Nothing
- oPPT.Quit
- Set oPPT = Nothing
- Else
- Msgbox "请将文件拖到程序上~",,"【老刘制作】PPT转图片"
- End If
复制代码 英译有什么错误望各路高手指教,就当练习英语了。 |