Good Pdf utility

M

M_C

I am currently using pdf995's omniformat to batch process txt to pdf's. Does
anyone have a recommendation for an alternative?
 
M

M_C

But does it work as a batch utility? I need to convert a directory of files
into pdf's, they are text files created by another program.

Mike
 
G

Graham Mayor

Provided you have Word 2007, then yes, you can batch process files with the
Word PDF creation tool.

If that tool is installed, the following macro will work with all documents
in doc or docx format in a folder selected from the macro. The macro will
throw an error if any of the documents are mail merge documents, but should
work fine with documents that contain simply text. If the documents are
plain text with a TXT extension then the macro will require some changes,
but we'll cross that bridge if required.

Sub SaveAllAsPDF()
Dim strFileName As String
Dim strDocName() As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User", , "Save all as PDF"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) <> "\" Then strPath = strPath + "\"
End With
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
strFileName = Dir$(strPath & "*.doc")
While Len(strFileName) <> 0
WordBasic.DisableAutoMacros 1
Set oDoc = Documents.Open(strPath & strFileName)
strDocName = Split(oDoc.FullName, ".")
If ActiveDocument.SaveFormat = 0 Or _
ActiveDocument.SaveFormat = 12 Then
ActiveDocument.SaveAs _
FileName:=strDocName(0) & ".pdf", _
FileFormat:=wdFormatPDF
End If
oDoc.Close SaveChanges:=wdDoNotSaveChanges
strFileName = Dir$()
Wend
WordBasic.DisableAutoMacros 0
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
T

Terry Farrell

Note that if you have Word 2007 and it is not installed, the PDF add-on is a
free download from Microsoft Office support site.
 
M

M_C

Thank-you! I will look into it.

Graham Mayor said:
Provided you have Word 2007, then yes, you can batch process files with the
Word PDF creation tool.

If that tool is installed, the following macro will work with all documents
in doc or docx format in a folder selected from the macro. The macro will
throw an error if any of the documents are mail merge documents, but should
work fine with documents that contain simply text. If the documents are
plain text with a TXT extension then the macro will require some changes,
but we'll cross that bridge if required.

Sub SaveAllAsPDF()
Dim strFileName As String
Dim strDocName() As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User", , "Save all as PDF"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) <> "\" Then strPath = strPath + "\"
End With
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
strFileName = Dir$(strPath & "*.doc")
While Len(strFileName) <> 0
WordBasic.DisableAutoMacros 1
Set oDoc = Documents.Open(strPath & strFileName)
strDocName = Split(oDoc.FullName, ".")
If ActiveDocument.SaveFormat = 0 Or _
ActiveDocument.SaveFormat = 12 Then
ActiveDocument.SaveAs _
FileName:=strDocName(0) & ".pdf", _
FileFormat:=wdFormatPDF
End If
oDoc.Close SaveChanges:=wdDoNotSaveChanges
strFileName = Dir$()
Wend
WordBasic.DisableAutoMacros 0
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Sheila W

For someone who don't have word 2007, you may try googledocs. It is good and
easy to use too.

Although cannot for batch conversion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top