Board logo

标题: [原创] PPT转JPEG图片小工具/第三方 [打印本页]

作者: 老刘1号    时间: 2017-7-21 23:19     标题: PPT转JPEG图片小工具/第三方

本帖最后由 老刘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):
  1. Option Explicit
  2. If WScript.Arguments.Count > 0 Then
  3. Dim oPPT,oPPTFile,[幻灯片],[计数器],fso,Arg
  4. Set fso = CreateObject("Scripting.FileSystemObject")
  5. Set oPPT = CreateObject("PowerPoint.Application")
  6. Dim PPTFilePath,PPTFileBaseName
  7. For Each Arg In WScript.Arguments
  8. If fso.FileExists(Arg) And _
  9. (UCase(fso.GetExtensionName(Arg)) = "PPT" Or UCase(fso.GetExtensionName(Arg)) = "PPTX") Then
  10. With fso
  11. PPTFilePath = .GetParentFolderName(Arg)
  12. PPTFileBaseName = .GetBaseName(Arg)
  13. End With
  14. If Not fso.FolderExists(PPTFilePath&"\"&PPTFileBaseName) Then
  15. fso.GetFolder(PPTFilePath).SubFolders.Add PPTFileBaseName
  16. End If
  17. Set oPPTFile = oPPT.Presentations.Open(Arg)
  18. [计数器] = 0
  19. For Each [幻灯片] In oPPTFile.Slides
  20. [计数器] = [计数器] + 1
  21. [幻灯片].Export PPTFilePath&"\"&PPTFileBaseName&"\"&PPTFileBaseName&" ("&[计数器]&").JPG","JPG"
  22. Next
  23. oPPTFile.Close
  24. Set oPPTFile = Nothing
  25. End If
  26. Next
  27. oPPT.Quit
  28. Set oPPT = Nothing
  29. Else
  30. MsgBox "请将文件拖到程序上~",,"【老刘制作】PPT转图片"
  31. End If fso.GetFolder(PPTFilePath).SubFolders.Add PPTFileBaseName
  32. End If
  33. Set oPPTFile = oPPT.Presentations.Open(WScript.Arguments(0))
  34. [计数器] = 0
  35. For Each [幻灯片] In oPPTFile.Slides
  36. [计数器] = [计数器] + 1
  37. [幻灯片].Export PPTFilePath&"\"&PPTFileBaseName&"\"&PPTFileBaseName&" ("&[计数器]&")."&"JPG","JPG"
  38. Next
  39. oPPTFile.Close
  40. Set oPPTFile = Nothing
  41. oPPT.Quit
  42. Set oPPT = Nothing
  43. Else
  44. Msgbox "请将文件拖到程序上~",,"【老刘制作】PPT转图片"
  45. End If
复制代码
英译有什么错误望各路高手指教,就当练习英语了。




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2