Group: microsoft.public.word.vba.general
From: =?Utf-8?B?RHlsYW4=?=
Date: Monday, March 31, 2008 9:08 AM
Subject: RE: Printing Doc Sections to PDF

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