RE: Converting 1000s of files to PDF

Subject: RE: Converting 1000s of files to PDF
From: Michael LaRiviere <michael -dot- lariviere -at- ncompasslabs -dot- com>
To: "'techwr-l -at- lists -dot- raycomm -dot- com'" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: Fri, 22 Oct 1999 09:23:44 -0700


>But here's the mind-numbing part: Windows prompts for the
>filenames for each of the postscript files! I would like to keep the
>same filename (just have the PS or even PRN extension). Does
>anyone know of how to automate this bit?
>
> - Michele

If you are using MS Word macros will work. The following macro searches a
folder for .Doc files and prints them to PostScript. You will need to change
the hard-coded print driver to match one of the print drivers on your
computer. I hope this helps.

(Note that as-is the macro will change your default print driver but it will
not undo the change when it is finished. Just remember to reset it
manually.)

Michael LaRiviere
michael -dot- lariviere -at- ncompasslabs -dot- com

Sub DOC2PS()
'
' DOC2PS Macro
'
' Tested on Word 97, WinNT4(sp5)
'
' This macro searches a target directory for DOC files and prints them to
' file (postscript) with a ".ps" appended to their filename. It uses
' the print driver named "default postscript driver".
'
'

Set fs = Application.FileSearch
With fs

' change location to suit your system
.LookIn = "C:\Docs\"
.FileName = "*.doc"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."

' change printer name to match your system
ActivePrinter = "Default PostScript Printer"

For i = 1 To .FoundFiles.Count

' change location
ChangeFileOpenDirectory "C:\Docs\"
Dim currentDoc
Dim outputDoc

currentDoc = .FoundFiles(i)
outputDoc = (currentDoc + ".ps")

Documents.Open FileName:=currentDoc, ConfirmConversions:=False,
ReadOnly:= _
False, AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto

Application.PrintOut FileName:="", Range:=wdPrintAllDocument,
Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=True,
OutputFileName:=outputDoc, _
Append:=False
ActiveWindow.Close

Next i
Else
MsgBox "No files found."
End If
End With

End Sub









Previous by Author: Linux screen capture tool?
Next by Author: What do technial writers think about Adobe InDesign?
Previous by Thread: Re: Converting 1000s of files to PDF
Next by Thread: RE: Converting 1000s of files to PDF


What this post helpful? Share it with friends and colleagues:


Sponsored Ads