dimanche 26 avril 2015

VBA code prints each page into separate files

I have a protected MS word document, i have multiple pages so i have added a checkbox to each page and written a macro so that only the pages with the checkbox are printed, however when i run the macro, and try to print as a pdf each page is a separate file, i would like for it to print the selected pages as a single pdf, any ideas

here is my code

Sub printmake()
    If ActiveDocument.FormFields("Check31").Result = 1 Then
    ActiveDocument.ActiveWindow.PrintOut _
    Range:=wdPrintFromTo, From:="1", To:="1"
    End If

    If ActiveDocument.FormFields("Check30").Result = 1 Then
    ActiveDocument.ActiveWindow.PrintOut _
    Range:=wdPrintFromTo, From:="2", To:="2"
    End If
    If ActiveDocument.FormFields("Check29").Result = 1 Then
    ActiveDocument.ActiveWindow.PrintOut _
    Range:=wdPrintFromTo, From:="3", To:="3"
    End If
    If ActiveDocument.FormFields("Check28").Result = 1 Then
    ActiveDocument.ActiveWindow.PrintOut _
     Range:=wdPrintFromTo, From:="4", To:="4"
    End If
 END Sub




Aucun commentaire:

Enregistrer un commentaire