Hi, I'm using the following macro to print a mailmerged document's sections
to PDF Files.

How do I call a text value from each section, e.g. the 65th word (the last
word on the fifth row of the table) and depending whether i = an Odd or Even
number call the document "Report" or "Appendix A" respectively?

So that the filename is something like "11125 Report.PDF", or "11125
Appendix A.PDF"

Sub PrintSections()

Dim i As Long
For i = 1 To ActiveDocument.Sections.Count
ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" &
i, _
OutputFileName:=(i & ".jpg")
Next i

End Sub

Thank you
DDawson

RE: Printing Doc Sections to PDF by Dylan

Dylan
Mon Mar 31 07:08:01 PDT 2008

Can you please tell me why I can't open the PDFs outputted from this macro.

Sub PrintSections()

Dim i As Long
For i = 1 To ActiveDocument.Sections.Count
ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" &
i, _
OutputFileName:=(i & ".pdf")
Next i

End Sub

"Dylan" wrote:

> Hi, I'm using the following macro to print a mailmerged document's sections
> to PDF Files.
>
> How do I call a text value from each section, e.g. the 65th word (the last
> word on the fifth row of the table) and depending whether i = an Odd or Even
> number call the document "Report" or "Appendix A" respectively?
>
> So that the filename is something like "11125 Report.PDF", or "11125
> Appendix A.PDF"
>
> Sub PrintSections()
>
> Dim i As Long
> For i = 1 To ActiveDocument.Sections.Count
> ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" &
> i, _
> OutputFileName:=(i & ".jpg") '[ error - should be ".pdf"]
> Next i
>
> End Sub
>
> Thank you
> DDawson