ich habe einen Sub, der via VBA PDF-Dateien aus Hyperlinks einer Exceltabelle öffnet, alle Seiten außer der ersten löscht und anschließend die erste Seite als neues PDF speichert, zusammengeflickt. Das funktioniert auch soweit.
Ich würde diesen Sub nun gerne dahingehend erweitern, dass die PDF-Seite nicht mehr als *.pdf, sondern als *.jpg gespeichert wird. Kann mir hierbei jemand helfen?
Untenstehend der Code.
Noch eine Interessenfrage zum Code:
Die .Save Anweisung funktioniert nur in einer if-Anweisung (siehe kompletten Code), jedoch nicht so:
PDDocSource.Save(&H1, strDestinationFullPath)
Warum ist das so?
Viele Dank schon mal im Voraus!
Stefan
Sub DeletePDFPages(strDestinationFullPath, strSourceFullPath, Workbook, Blatt, Zeile)
Dim PDDocSource As Object
Dim i As Boolean
Set PDDocSource = CreateObject("AcroExch.PDDoc")
i = False
' Open the PDF source file (the file we are going to take pages from)
If PDDocSource.Open(strSourceFullPath) True Then
Workbooks(Workbook).Sheets(Blatt).Rows(Zeile).Interior.ThemeColor = xlThemeColorAccent1
i = True
End If
' Delete pages
Do Until i = True
If PDDocSource.DeletePages(1, 1) True Then
i = True
End If
Loop
' Save the new file
If PDDocSource.Save(&H1, strDestinationFullPath) True Then
MsgBox ("Speichern nicht möglich: " & strDestinationFullPath)
End If
' Close the file
PDDocSource.Close
End Sub