Hello,
I need to convert Word document to PDF using distiller constantly. I have recorded a macro as follows. It works OK. Just two things that are annoying:
1. Before the VB Macro close the document, it asked if I want to save the changes. How can I get rid of this automatic pop-up window?
2. Distiller keep asking for a name for saving the document. How can I integrate a piece of code to let distiller save the file using the name in word document with PDF extension.
Thanks a lot.
B. Lin
The code I used:
Sub WORD_to_PDF
'
'
The_Input_Path = "t:\output\"
ChangeFileOpenDirectory The_Input_Path
TheFile = Dir("*.doc"
Do
opfile = TheFile
Documents.Open FileName:=opfile, ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
Selection.WholeStory
Selection.Font.Name = "Monospac821 BT"
ActiveWindow.ActivePane.SmallScroll Down:=93
ActiveWindow.ActivePane.VerticalPercentScrolled = 0
Selection.Font.Name = "Monospac821 BT"
ActivePrinter = "Acrobat Distiller"
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
ActiveDocument.Close
TheFile = Dir
Loop While TheFile <> ""
End Sub
I need to convert Word document to PDF using distiller constantly. I have recorded a macro as follows. It works OK. Just two things that are annoying:
1. Before the VB Macro close the document, it asked if I want to save the changes. How can I get rid of this automatic pop-up window?
2. Distiller keep asking for a name for saving the document. How can I integrate a piece of code to let distiller save the file using the name in word document with PDF extension.
Thanks a lot.
B. Lin
The code I used:
Sub WORD_to_PDF
'
'
The_Input_Path = "t:\output\"
ChangeFileOpenDirectory The_Input_Path
TheFile = Dir("*.doc"
Do
opfile = TheFile
Documents.Open FileName:=opfile, ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
Selection.WholeStory
Selection.Font.Name = "Monospac821 BT"
ActiveWindow.ActivePane.SmallScroll Down:=93
ActiveWindow.ActivePane.VerticalPercentScrolled = 0
Selection.Font.Name = "Monospac821 BT"
ActivePrinter = "Acrobat Distiller"
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
ActiveDocument.Close
TheFile = Dir
Loop While TheFile <> ""
End Sub