Stephen_IV
Well-known Member
- Joined
- Mar 17, 2003
- Messages
- 1,176
- Office Version
- 365
- 2019
- Platform
- Windows
Good morning,
This above my skill set. I got this code from 'http://www.tek-tips.com/viewthread.cfm?qid=1538892
and it works great. The problem is that it output the files onto the desktop (could be hundreds of files). Is there any way to modify this to output them into a folder on the desktop?
This above my skill set. I got this code from 'http://www.tek-tips.com/viewthread.cfm?qid=1538892
and it works great. The problem is that it output the files onto the desktop (could be hundreds of files). Is there any way to modify this to output them into a folder on the desktop?
Code:
'http://www.tek-tips.com/viewthread.cfm?qid=1538892
'Tools > References > Acrobat
Sub Main()
Dim PDDoc As Acrobat.CAcroPDDoc, newPDF As Acrobat.CAcroPDDoc
Dim PDPage As Acrobat.CAcroPDPage
Dim thePDF As String, PNum As Long
Dim f As String, i As Integer, Result As Variant, NewName As String
f = ThisWorkbook.Path & "\"
thePDF = f & "transcriptgrade12.pdf"
Set PDDoc = CreateObject("AcroExch.pdDoc")
Result = PDDoc.Open(thePDF)
If Not Result Then
MsgBox "Can't open file: " & thePDF
Exit Sub
End If
'...
PNum = PDDoc.GetNumPages
For i = 0 To PNum - 1
Set newPDF = CreateObject("AcroExch.pdDoc")
newPDF.Create
NewName = f & " Page_" & i & "_of_" & PNum & ".pdf"
newPDF.InsertPages -1, PDDoc, i, 1, 0
newPDF.Save 1, NewName
newPDF.Close
Set newPDF = Nothing
Next i
End Sub