Guest User

Untitled

a guest
Jun 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. 'search for title 1
  2. Selection.Find.ClearFormatting
  3. Selection.Find.Style = ActiveDocument.Styles("Titre 1")
  4. Selection.Find.Execute
  5. 'icount < 1000 just in case of infinite loop
  6. Do While Selection.Find.Found = True And icount < 1000
  7.  
  8. Title1Array(icount) = Selection.Information(wdActiveEndPageNumber) 'current page
  9. TitleTxtArray(icount) = Selection.text 'curent title
  10.  
  11. Selection.Find.Execute 'search next title1
  12. icount = icount + 1
  13.  
  14. Loop
  15.  
  16. Dim title As String
  17. Dim pagestart As Long
  18. Dim pagesEnd As Long
  19.  
  20. For i = 1 To icount
  21. pagestart = Title1Array(i)
  22. nexti = i + 1
  23. pagesEnd = Title1Array(nexti) - 1 'page end is (next title1 page) - 1
  24. title = ActiveDocument.Path & "" & TitleTxtArray(i) & ".pdf"
  25. ActiveDocument.ExportAsFixedFormat OutputFileName:= _
  26. title, ExportFormat:=wdExportFormatPDF, _
  27. OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:= _
  28. wdExportFromTo, From:=pagestart, To:=pagesEnd, Item:=wdExportDocumentContent, _
  29. IncludeDocProps:=True, KeepIRM:=False, CreateBookmarks:= _
  30. wdExportCreateHeadingBookmarks, DocStructureTags:=True, _
  31. BitmapMissingFonts:=False, UseISO19005_1:=False
  32. Next i
Add Comment
Please, Sign In to add comment