Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1244
  • Last Modified:

Word Macro to print PDF

I need a macro to print an open document as a pdf and automatically put in the name of the output PDF to be the same as the incoming name.

It would also be good to be able to specify in the macro where the output PDF is going to be saved.

I tried to record one, but it hangs at the point where it asks what name to give it.

Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
        ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
        False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0
    With Options
        .UpdateFieldsAtPrint = False
        .UpdateLinksAtPrint = False
        .DefaultTray = "Use printer settings"
        .PrintBackground = True
        .PrintProperties = False
        .PrintFieldCodes = False
        .PrintComments = False
        .PrintHiddenText = False
        .PrintXMLTag = False
        .PrintDrawingObjects = True
        .PrintDraft = False
        .PrintReverse = False
        .MapPaperSize = False
        .PrintOddPagesInAscendingOrder = False
        .PrintEvenPagesInAscendingOrder = False
        .PrintBackgrounds = False
    End With
    With ActiveDocument
        .PrintPostScriptOverText = False
        .PrintFormsData = False
    End With

Thanks
0
911bob
Asked:
911bob
  • 4
  • 3
1 Solution
 
Joanne M. OrzechManager, Document Services CenterCommented:
What version of Adobe are you using?  You can set it in Adobe to capture the file name and create the PDF so all you have to really do is print the file to the PDF printer....

    ActivePrinter = "Adobe PDF"
    Application.PrintOut

Open in new window

0
 
911bobCTOAuthor Commented:
That does exactly what mine does.. It brings up the dialog box asking where and what name you want to save it as.

How do I get that to be fed in automatically so you do not have to specify the name or location?

Name should defautl to the MS Word Doc name
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
It depends - what version of Adobe are you running?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
911bobCTOAuthor Commented:
ACROBAT 7
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
Right click on Start, go to the Printers, right-click on Adobe PDF, go to Properties.  The first box that comes up has an option to "Prompt for Filename" - deselect that.

See if that works.
0
 
911bobCTOAuthor Commented:
It was actually under Printing preferences after I opened the properties dialog, but you can specify where it gets saves there.

Thanks
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
Excellent!  Glad to have been of assistance.  (I'm still running Adobe 6 Professional... so ....)

JOrzech
Word MVP
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now