ฉันต้องการใช้ VBA เพื่อวนซ้ำหน้าเอกสาร MS Word ของฉันและพิมพ์แต่ละหน้าเป็น PDF แยกกัน ชื่อไฟล์ PDF แต่ละไฟล์จะต้องขึ้นบรรทัดแรกพร้อมข้อความในแต่ละหน้า ฉันกำลังลองบางอย่างตาม:
Sub printSepPdf()
Dim pages As Page
Dim p As Paragraph
For Each pages In ActiveDocument
ActiveDocument.ExportAsFixedFormat OutputFileName:=p.Range.Sentences(1) & ".pdf", ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:= _
wdExportFromTo, From:=1, To:=1, Item:=wdExportDocumentContent, _
IncludeDocProps:=False, KeepIRM:=False, CreateBookmarks:= _
wdExportCreateHeadingBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=False, UseISO19005_1:=False
Next pages
End Sub