Wandelt eine Powerpoint-Präsentation (ppt) in einzelne Bilder des Typs *.png um.
Sie benötigen 1 Form, zwei Textboxen (Text1 und Text2), sowie einen Commandbutton.
Private Sub Command1_Click()
Dim pptAppl As PowerPoint.Application
Dim pptPres As PowerPoint.Presentation
Dim pptWarOffen As Boolean
Dim path As String
Dim DestPath As String
PathPPT = Text1.Text 'Pfad zur PPT-Datei
DestPath = Text2.Text 'Zielordner zB C:\test
On Error Resume Next
Set pptAppl = GetObject(, "PowerPoint.Application")
On Error GoTo errorMsgPPT
If pptAppl Is Nothing Then
Set pptAppl = CreateObject("PowerPoint.Application")
Else
pptWarOffen = True
End If
Me.MousePointer = vbHourglass
'Presentation unsichtbar öffnen
Set pptPres = pptAppl.Presentations.Open(FileName:=PathPPT, withwindow:=msoFalse)
pptPres.Export DestPath, "png", 800, 600
pptPres.Close
If pptWarOffen = False Then
pptAppl.Quit
End If
Set pptPres = Nothing
Set pptAppl = Nothing
Me.MousePointer = vbDefault
Exit Sub
errorMsgPPT:
Resume
Me.MousePointer = vbDefault
MsgBox "Error: " & _
Err.Description & vbCrLf & _
Err.Number
Set pptPres = Nothing
Set pptAppl = Nothing
End Sub
Private Sub Form_Load()
' Unbedingt Verweis auf "Microsoft PowerPoint 10.0 Object Library"
' setzen ! "10.0" steht für Office XP, auch andere Varianten sind
' möglich.
Text1.Text = "C:\test\sample.ppt"
Text2.Text = "C:\output"
Command1.Caption = "Convert !"
End Sub