1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

大量のPowerPointファイルをPNG画像に変換するときに使ったVBScript

Last updated at Posted at 2021-10-25

Windows 7で動作確認しました。(なぜ今でもWin7なのかは聞かないでください)

Option Explicit
' 使い方
' 本VBScriptファイルを「D:¥」に保存する。(他のフォルダでも動作は可能)
' PPTX保存用フォルダとして「D:¥png」を作成する。
' PPTX ファイルを「D:¥pptx」に置く
' 画像保存用フォルダとして「D:¥png」を作成する。
' 本VBScriptファイルをダブルクリックする

' File System Object
Dim objFso 
Set objFso = CreateObject("Scripting.FileSystemObject")
' Wsh Shell
Dim objWshShell
Set objWshShell = WScript.CreateObject("WScript.Shell")
' PowerPoint App
Dim objPptApp
Set objPptApp = WScript.CreateObject("PowerPoint.Application")
' PowerPoint Slide
Dim oSlide
' PPT
Dim objPptDoc

Dim strPath
Dim outPath 
Dim imgName

strPath = "D:¥pptx"
outPath = "D:¥png¥"

' WScript.Echo strPath
Dim obj 'As Object

For Each obj In objFso.getfolder(strPath).Files
	If Right(obj.Name,5) <> ".pptx" Then
		
	Else
		Set objPptDoc = objPptApp.Presentations.Open(strPath & "¥" & obj.Name)
		For Each oSlide In objPptApp.ActivePresentation.Slides
			imgName = outPath & objFso.getbasename(obj.Path) & oSlide.SlideIndex & ".png"
			oSlide.Export imgName, "png"
		Next
		objPptDoc.Close
		Set objPptDoc = Nothing
	End If
Next

objPptApp.Quit

Set objFso = Nothing

WScript.Echo "Finished"

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?