Thursday, July 8, 2004

Word, Acrobat and VBA – Oh My!

— Matt Harris @ 8:15 pm

At work, I have a lot of Microsoft Word documents (close to a hundred) that I need to convert into Adobe Acrobat PDF files. Printing them one at a time to Acrobat Distiller was just too mind-numbingly tedious for words. Being the geeky sort, I decided to write a VBA subroutine to distill all of the Word files that were in a single directory with a single button press.

I wrote the code and it seemed to work just fine and dandy. It certainly was very quick. Then a coworker took a look at the PDF documents and discovered that Acrobat Distiller had screwed up the pagination. The strange thing was, Distiller worked just fine from within Microsoft Word. It was only when the VBA subroutine was printing the documents that things were getting screwed up. Obviously there was something wrong with my code. Wouldn’t be the first time that had happened. So back to drawing board I went.

After another half-hour or so, I came to a remarkable discovery. In my initial design, I had decided to set the active printer to Acrobat Distiller from inside the subroutine. This was in order to prevent accidentally printing several hundred pages of documents to a real printer, which had happened in the past. I recorded a macro while manually changing the printer to Acrobat Distiller and took a look at the code the Macro Recorder produced. There was only one line of code, which I took and placed in my subroutine prior to printing:

   ActivePrinter = “Acrobat Distiller”

Turns out that this was the reason the pagination was being screwed up. If I commented out this line and set the active printer via the UI, everything worked just fine.

My remarkable discovery:
The same action when done in VBA can work differently than when done via the user interface, even when using code produced by Word’s Macro Recorder.

And how was your day? 🙂

Update: July 9, 2004 at 5:26 PM
Apparently, it wasn’t setting ActivePrinter in VBA – I am still getting the error whenever I print using code. 🙁

Update: July 12, 2004 at 2:57 PM
Also, it happens when I print to Distiller from Explorer.

Update: July 19, 2004 at 8:15 PM
Adding a single space before the carriage return at the offending sections seems to correct the problem.

Comments Off on Word, Acrobat and VBA – Oh My!
Wednesday, July 7, 2004

Tonight’s IRC Chat Transcript

— Matt Harris @ 8:59 pm

A pretty good chat tonight – we had five people show up: Matt Harris (myself), Death Is Your Art, Lorne’s Lady, Elais and Amy Madison. The transcript is here.

Comments Off on Tonight’s IRC Chat Transcript
Monday, July 5, 2004

Slightly Skewed Recaps

— Matt Harris @ 5:16 pm

It came to my attention during a chat Saturday night that there were some people who had never heard of the Slightly Skewed Recaps of the Harry Potter films. Such a terrible tragedy demands that I immediately link to said recaps:

Slightly Skewed Recap of Harry Potter and the Sorcerer’s Stone

Slightly Skewed Recap of Harry Potter and the Chamber of Secrets

The recaps are simply still screen captures from the films, with an alternate version of the dialogue posted from the viewpoint of a Harry/Hermione shipper. To be blunt, they are hilarious. Even non-Harry/Hermione shippers will love them.

The rest of the site is pretty good, too, with lots of screen caps of the actors from the films and some interesting essays.

Comments Off on Slightly Skewed Recaps
Sunday, July 4, 2004

Chat Transcript Posted

— Matt Harris @ 11:40 am

I have posted the Succubus Club IRC Chat Transcript from Wednesday, June 30.

Comments Off on Chat Transcript Posted
Archives

  • 1530s Europe Campaign (15)
  • Books (7)
  • BTVS & Angel (24)
  • Cormaria (22)
  • Doctor Who (1)
  • Fanfiction Recs (19)
  • General (36)
  • Harry Potter (19)
  • Humor (16)
  • Java (1)
  • Microsoft Office (2)
  • Northridge Pathfinder (24)
  • OpenOffice.org (1)
  • Pathfinder (30)
  • Politics (4)
  • Programming (6)
  • Programs (5)
  • Reviews (2)
  • Role-Playing Games (D&D et. al.) (85)
  • Science (1)
  • Site News (120)
  • Smallville (2)
  • Stargate (2)
  • Tips (4)




  • Powered by Wordpress