Word to PDF

word to pdf
A week ago had a personal task to convert 40 or so word documents to pdf in standard and minimum size. Doing them by one at a time was felt such a waste, so recorded and edited a vba macro to do the same task in a jiffy.

Here’s the simple vba subroutine to do the conversion.

Sub MakePDFStandard_and_Min()

Dim base_name As String
Dim base_path As String

base_path = ActiveDocument.path
base_name = ActiveDocument.name

ActiveDocument.ExportAsFixedFormat OutputFileName:= _
base_path &  "\" & base_name & ".pdf", _
ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False

ActiveDocument.ExportAsFixedFormat OutputFileName:= _
base_path &  "\" & base_name &  "_min" & ".pdf", _
ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForOnScreen, Range:=wdExportAllDocument, From:=1, To:=1, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False

End Sub

How to use this?

Open Microsoft word
Click Alt+F11
Open the normal.doc in the vba editor
Copy paste the above code in the vba editor
Assign a shortcut key

That’s it.

To use it, load a document and then press the shortcut key and two PDF’s will be created in the location of your document. One with “_min” has minimum size and the other is standard.

Advertisements

2 thoughts on “Word to PDF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s