Drag and Drop Convert Word to PDF

Sometimes I find that it’s useful to save my Word documents as PDFs.

After playing around with the Save As PDF plugin for Office, I decided that it would be cool if I could write a script to convert a job lot of Word documents.

MS Word 2007
Save As PDF Office 2007 Plugin

Just copy and paste the code into Notepad and save the file as WordToPDF.vbs on your desktop.

<code>'Word to PDF
'By John Reid
'(c) 2007 bloggingIT - http://www.maxpower.plus.com
'Feel free to use, modify, and redistribute - just leave the credits intact
'Quick Export to PDF
Const wdExportAllDocument = 0
Const wdExportOptimizeForPrint = 0
Const wdExportDocumentContent = 0
Const wdExportFormatPDF = 17
Const wdExportCreateHeadingBookmarks = 1

if  Wscript.Arguments.Count > 0 Then
  'Fire up MS Word 2007
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objWord = CreateObject("Word.Application")

  'Enumerate the passed in file names
  For i = 0 to wscript.arguments.count - 1
  Set objFile = objFSO.GetFile(WScript.Arguments(i))
  Set objDoc = objWord.Documents.Open(WScript.Arguments(i),,TRUE)
  dirPath = objFSO.GetParentFolderName(objFile)
  fileBaseName = objFSO.GetBaseName(objFile)
  'Export to PDF using preferred settings
  pdf = objWord.ActiveDocument.ExportAsFixedFormat _
    (dirPath & "\" & fileBaseName & ".pdf", _
    wdExportFormatPDF, False, wdExportOptimizeForPrint, _
   wdExportAllDocument,,, _
   wdExportDocumentContent, _
   False, True, _
 'Quit MS Word
 msgbox("You must select a file to convert")
End If</code>

When you find a document that you wish to convert, just drag and drop the file onto the script.

Right, there’s an Excel version along shortly.

Upgrading from Office 2007 BETA 2 to Trial

I recently downloaded the Office 2007 Trial to replace the buggy BETA 2 Technical Refresh that I had. I’ve encountered some issues that others probably will, and a few workarounds.

  • Cannot open files saved in BETA 2 with the Office Compatibility Pack
    This is not strictly an issue with using the trial software, but it is relevant if upgrading from BETA 2. The issue is that you cannot use the final conversion pack to open Office 2007 BETA 2 documents. The only way around this is to open and save any Office documents that you have created with BETA 2.
  • Cannot download the Save As PDF or XPS plugin
    The plugin can only be downloaded if you have a fully licenced version of Office installed on your computer to authenticate with the Office Genuine Advantage requirement. This was a nuisance to me as I’d quite happily been exporting PDFs in Office for some time.
    Anyway, the trick is that you can download the Save As PDF or XPS tool with any version of Office installed as long is it passes validation. I used a computer with Office 2003 installed to download the plugin. Just copy the installer to the Office 2007 Trial that you wish you install it on and install.
  • You get an error telling you that you need to uninstall Office 2007 prerelease versions and cannot upgrade.
    In fact, the error is

    The 2007 Microsoft Office system does not support upgrading from a prerelease version of the 2007 Microsoft Office system. You must first uninstall any prerelease versions of the 2007 Microsoft Office system products and associated technologies.
    Correct the issue(s) listed above and re-run setup.

    If you’re like me, you probably became quickly frustrated with the fact that you HAD uninstalled every component of Office 2007 BETA 2 already. There is a knowledgebase article which goes through the registry and other long-winded methods, but it’s much simpler to download MyUninstaller from NirSoft.
    Run MyUninstaller, and you will probably see some leftover Office 2007 MUL Packs. Uninstall everything related to Office 2007, and restart the Office 2007 Final installation. It should run through without a hitch.

MS Word’s Blogging Time Tunnel

Some people have commented that I seem to have started my blog in 1970. Those more in the know will realise that it’s about a decade before I was born, nevermind the fact that the Web wasn’t around then.

It’s Microsoft Word’s built-in blogging feature. I’ll give it credit. At least it managed to post the article straight into WordPress. Pity that it doesn’t know what date it is yet.

Office 2003 SP2 Released

I see that MS Office 2003 Service Pack 2 is now available for download through Microsoft Update.

I’m actually impressed with how well Microsoft Update appears to work. When I got home from work today, there was an update icon in my tray with Service Pack 2 ready to install.

Although, every cloud has a silver lining, and every bin has a bin liner.

Although the installation is fine, the update process lets itself down by having to restart once the installation is complete.


As for the service pack, no new features seem to have been introduced. Although if you do want it, a list of changes is available for download.

Now I’d better go and reboot my PC…

I Nest My (Documents) Case

An odd problem popped up today. Every time I attempted to save or open a file in my network area, I’d get the following error:

Invalid Page Fault in module Kernel32.dll

It turns out that it’s because I have a folder called ‘My Documents’ in the My Documents folder. Every time I clicked on it, Word 2000 would throw its toys out of the pram and crash and burn, taking my work with it.

The solution was found on in KB304504. Apparently it only affects Office 2000 thankfully.

Needless to say, my punning has pleased me no end today :)