Export to Pdf
Hallo to everybody,
browsing the forum I found a sample with the following code and I am trying to modify to get as output a single Pdf file of "iEnd" pages. But without success.
Can you please help?
Thanks and Regards
JohnBi
Sub CertificatePrint()
Dim iStart As Integer, iEnd As Integer, i As Integer
On Error GoTo ErrHandler
With ActiveDocument.Shapes(1).TextFrame.TextRange.Field s(1)
iStart = CInt(InputBox("What is the first Certificate to print?", _
"Print Certificates From", Split(Split(.Code.Text, " ")(0), "=")(1)))
iEnd = CInt(InputBox("What is the last Certificate to print?", _
"Print Certificates To", iStart))
If iStart = 0 Or iStart > iEnd Then Exit Sub
For i = iStart To iEnd
If i = iStart Then
With Application.Dialogs(wdDialogFilePrint)
If .Show = 0 Then Exit Sub
End With
End If
.Code.Text = "=" & i & " \# 000"
.Update
'ActiveDocument.PrintOut
' Next
'---------- export pdf
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
ActiveDocument.Path & "\" & ActiveDocument.Name & ".pdf", ExportFormat:= _
wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
On Error GoTo ErrHandler
Next
End With
ErrHandler:
End Sub
|