kccosavannah
Board Regular
- Joined
- Sep 30, 2014
- Messages
- 82
I have a word document with about 350 pages total. I would like to print each page as a separate PDF. I would like to save each file and reference the quote number that is on each sheet. So page 1 would be 154789.pdf and page two might be 1578964.pdf.
I have the following code that is working but it is saving each page but it is asking me to save each page and creating a separate word doc and then saving the PDF.
Can someone help me amend this code?
I have the following code that is working but it is saving each page but it is asking me to save each page and creating a separate word doc and then saving the PDF.
Code:
Sub savepdf()
Dim Counter As Long, Source As Document, Target As Document
Set Source = ActiveDocument
Selection.HomeKey Unit:=wdStory
Pages = Source.BuiltInDocumentProperties(wdPropertyPages)
Counter = 0
While Counter < Pages
Counter = Counter + 1
DocName = "Page" & Format(Counter) & ".pdf"
Source.Bookmarks("\Page").Range.Cut
Set Target = Documents.Add
Target.Range.Paste
Target.SaveAs FileName:=DocName, FileFormat:=wdFormatPDF
Target.Close
Wend
End Sub
Can someone help me amend this code?