SMRT! It’s working!

I am so SMRT!

smrt.jpg

OpenNTF.org – Print attachments with OLE Automation

I can’t believe it, I got a Lotusscript working that prints file attachments from selected emails! It almost worked “out of the box” from this website, but the comments included additional clues, and I ended up registering so that I could ask a couple of specific questions.

In the meantime, I learned a tiny bit about how to load a Lotuscript – and even how to remove whitespace so that it’s properly formed (not difficult, as Lotus has highlighting all set up so you know when you’ve gone wrong). I tried a couple of copied-and-pasted methods, but this one was clean, and with the addition of the agent from the comments below it into the “Initialize” section, it worked – although it printed all the worksheet tabs, resulting in multiple sheets. I only needed it to print just the first sheet – but that question was quickly answered in the comments, and now all I have to do to print these is select a bunch of the incoming emails and hit an action menu item. I can’t seem to get it working automatically on incoming mails, but maybe it’s better to have a little more control so that I know that the printer is working… my printer is a trashed one that doesn’t have a working error code display for “Load Paper.”

This solves a really tedious problem we’ve been struggling with at work – basically, from one department at our major client, we receive all reservations as file attachments that can be TIF, PDF or MSExcel formats. We have Lotus Notes, and printing file attachments is normally done one email at a time, and there’s a lot of mouse-clicking. On Mondays and Tuesdays, when we receive 30-70 emails per day, that’s a lot of time spent opening, clicking, printing, closing, opening, clicking printing, closing. My supervisor has been doing this to free me or one of the other agents up for more important work taking calls or working on groups. It was a ridiculous use of her time.

The bit that I had to modify in order to just print the first sheet was in the Excel subroutine:

Private Sub PrintMSExcel (fname As String)Dim app As Variant  

Dim docToPrint As Variant  

On Error 208 Goto err208  

Set app = createobject("Excel.application")  

Set docToPrint = app.workbooks.open(fname)  

' No background print option for Excel, no need for special handling.
' Change (1,1) to () to print all worksheets  

Call docToPrint.PrintOut(1,1)

  

Call app.workbooks.close  

Call app.Quit()  

Set app = Nothing  

Exit Sub

It’s all good now, though. Monday, we’ll be ready for the onslaught. I even added a commented-out note to change the one setting to print all sheets if that’s what’s needed.

Recent Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *