Discussion:
Code to Print Current Document as PDF File in a Desired Folder
(too old to reply)
Steve
2009-02-10 17:31:17 UTC
Permalink
I’m trying to write a macro that will that will print the current document
that’s open to pdf file in a desired folder (in my case the folder is drive
z:\word).

I’m using Word 2007 with Adobe Pro v8.

In doing some research, it seems that I need to write a VBA code to
accomplish the task. I have a very limited knowledge base when it comes to
writing code. Here's what I've come up with so far.


Sub PrintPDF()
'
' PrintPDF Macro
'
'
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

Sub OpenFolder()
With Application.Dialogs(wdDialogFileOpen)
.Name = "Z:\Word"
.Show
End With
End Sub
Doug Robbins - Word MVP
2009-02-11 05:02:59 UTC
Permalink
If you set the properties for the Adobe PDF printer so that it does not ask
for the filename, it will automatically save the file with the path\filename
of the document that is being printed. Therefore have you macro first save
the document to the desired folder, then print the document and if you did
not want a copy of the Word document in that folder, use the Kill command to
delete it after closing it.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
I'm trying to write a macro that will that will print the current document
that's open to pdf file in a desired folder (in my case the folder is
drive
z:\word).
I'm using Word 2007 with Adobe Pro v8.
In doing some research, it seems that I need to write a VBA code to
accomplish the task. I have a very limited knowledge base when it comes to
writing code. Here's what I've come up with so far.
Sub PrintPDF()
'
' PrintPDF Macro
'
'
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
Sub OpenFolder()
With Application.Dialogs(wdDialogFileOpen)
.Name = "Z:\Word"
.Show
End With
End Sub
Loading...