#1
|
|||
|
|||
need help
hi
i have macro would like to save all pages individually as pdf But i get the same name on every PDF file. what do i have to change? Sub SaveAsSeparatePDFs() 'UpdatebyExtendoffice20181120 Dim I As Long Dim xDlg As FileDialog Dim xFolder As Variant Dim xStart, xEnd As Integer Dim dateiname As String On Error GoTo lbl Set xDlg = Application.FileDialog(msoFileDialogFolderPicker) If xDlg.Show <> -1 Then Exit Sub xFolder = xDlg.SelectedItems(1) xStart = CInt(InputBox("Start Page", "_")) xEnd = CInt(InputBox("End Page:", "_")) If xStart <= xEnd Then For I = xStart To xEnd With ActiveDocument dateiname = .Range(Start:=.Paragraphs(1).Range.Start, End:=.Paragraphs(1).Range.End - 1).Text & "_" Application.Browser.Target = wdBrowsePage Application.Browser.Next End With ActiveDocument.ExportAsFixedFormat OutputFileName:= _ dateiname & I & ".pdf", ExportFormat:=wdExportFormatPDF, _ OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:= _ wdExportFromTo, From:=I, To:=I, Item:=wdExportDocumentContent, _ IncludeDocProps:=False, KeepIRM:=False, CreateBookmarks:= _ wdExportCreateHeadingBookmarks, DocStructureTags:=True, _ BitmapMissingFonts:=False, UseISO19005_1:=False Next End If Exit Sub lbl: MsgBox "Enter right page number", vbInformation, "_" End Sub bes regard |
#2
|
||||
|
||||
The process saves numbered versions of the first paragraph of the document as the filename. The code also selects a path then doesn't use it?
If this is the output of a mail merge - see Merge and Split which will split it to PDF files, or better still use it to merge to PDF files.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
hi
i have installed your programm |
#4
|
|||
|
|||
your programm work!!!
|
|