PDA

View Full Version : How to select pages in an document and export as pdf to location



wdg1
02-24-2019, 02:30 AM
I have a document of 20 pages.
Now I want to print a range, as pdf and save in a folder.

To print the whole doc, it works as:

Dim sName As String
Dim sPath As String

With ActiveDocument
sName = Left(.Name, InStr(.Name, ".") - 1)
sName = sName & ".pdf"
sPath = "C:\Users\wardd\Documents\waitingfolder"


.ExportAsFixedFormat _
OutputFileName:=sPath & sName, _
ExportFormat:=wdExportFormatPDF
End With


End Sub

how select a range? eg page 1-6

Ward

macropod
02-24-2019, 05:24 AM
You should examine all of the parameters of the
.ExportAsFixedFormat method; it allows you to specify the pages to export.