Macro to print to non-default printer

S

Sharon L.

OK, this has me completely stymied. I have made macros to send print jobs to
different printers around the office - my default printer, a large printer
for massive jobs, and another printer for medium sized jobs. Two of them
work, one I can't get to work and it's driving me crazy. I'm on Word 2007.

I created all three the same way - record macro, then just went through the
steps of clicking on the Office button, selecting print, manually selecting
the printer I want, hit print, end recording. They work fine.

The third gives me "printer error" every time. When I hit "debug," the line
with the printer name is highlighted. I've tried every variation of the name
of the printer that I can think of, still nothing. I'm wondering if it's the
printer's name, which shows up as "Nancy's Printer M1522n on server01."
Could that apostrophe be throwing the macro off? I've looked on Nancy's
machine under Start/Settings/Printers & Faxes, chosen "properties" for her
printer and that's the way the name is showing up.

Here's the macro language, in case that will help:

Sub NancyPrinter()
'
' NancyPrinter Macro
'
'
ActivePrinter = "\\SCDESKTOP2\Nancy's Printer M1522n on server01"
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End Sub

Any suggestions would be greatly appreciated!! Thanks!
 
D

Doug Robbins - Word MVP

There's a good chance that the apostrophe is causing the problem.

You could try

ActivePrinter = "\\SCDESKTOP2\Nancy" & "'" & "s Printer M1522n on server01"


Or, you may want to take a look at
http://pubs.logicalexpressions.com/pub0009/LPMArticle.asp?ID=183

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
S

Sharon L.

Unfortunately, the language you suggested still came back with a printer
error. I've printed up the article you linked - it's like a foreign language
to me :) so I'll have someone take a look at it and see if they can figure
this out. Maybe the simplest thing to do would be to have them change the
printer name and start over!!

Thanks for the advice!
 
D

Doug Robbins - Word MVP

Yes, tell them to change it to the "Printer of Nancy ...."

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top