Automate printer settings (Landscape or Portrait sir?)


This is a bit o' code I used to have in a "resources" database you could download from my old site. Someone was trying to search the site for this today, so I'd best whack it back, eh!

Anyway, this code is all about automating that faffy moment when you realise your document really needs to be printed in landscape mode to fully prove its worth — but you just can't rely on users nowadays, can you?


So. The code. It was written by a VB person originally, and then Rob Hilhorst added to the code. I just grabbed it and cleaned it up, storing it in a script library. Download the attached LSS file, and do with it what you will (I suggest creating a blank script library, and then doing a File / Import with the LSS file).


This code has been tested in Notes 4.55, Windoze 95, Notes 5.05 and Win2k. In 95 it's cool. In 2k it raises an error, but still works. I suggest you use a handler to determine the error number, and then suppress it, for a cheap and nasty fix — or you could code it properly. Up to you… I have no use for the code right now, which is why I haven't been as conscientious with it as I should, but it's quite nifty.



  1. Initial testing (on a network where the user doesn't have print queue rights) shows that this code no longer works in Windoze 2000. To find out more, check out this thread over at the LDD Gold Forum.

    Ben Poole#
  2. I am trying to use your lotus script to set the printer to landscape mode. I am using the windows XP operating system and the lotus notes client 6.5. When I call the SetPrinterLandscape sub it errors with unable to open default printer. Tracking the code I think the lngPrinter variable is never getting set. In OpenDefaultPrinter sub I am confused by the line intResult = OpenPrinter(strDeviceName, lngPrinter, pdefs) as I see no OpenPrinter sub or function. Do you know if anyone has this code or something like it working for windows xp as this is vary valuable to me.Lynn Janisch#
  3. See the specs: this code doesn't work in XP or Notes 6.x. You're better off using a SendKeys implementation or similar.Ben Poole#
  4. Ben - seems to work fine for me in 2000 and v7.0 but how chan you change the printer back to portrait and have it stick without printing the form/doc again? I'm also trying to get it to close the printed document as well and Call uidoc.Close(True) after WshShell.SendKeys "{ENTER}" doesn't close the doc. SkipSkip#

Comments on this post are now closed.


I’m a software architect / developer / general IT wrangler specialising in web, mobile web and middleware using things like node.js, Java, C#, PHP, HTML5 and more.

Best described as a simpleton, but kindly. You can read more here.

File Attachment Icon