Macro to print to non-default printer

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!
0
Utf
12/22/2009 5:57:01 PM
word.vba.general 1023 articles. 1 followers. Follow

3 Replies
2975 Views

Similar Articles

[PageSpeed] 34

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

"Sharon L." <SharonL@discussions.microsoft.com> wrote in message 
news:AC8526BE-D578-472D-BFF1-75B2E398ACB4@microsoft.com...
> 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! 

0
Doug
12/22/2009 7:13:48 PM
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!

"Doug Robbins - Word MVP" wrote:

> 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
> 
> "Sharon L." <SharonL@discussions.microsoft.com> wrote in message 
> news:AC8526BE-D578-472D-BFF1-75B2E398ACB4@microsoft.com...
> > 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! 
> 
0
Utf
12/22/2009 7:31:02 PM
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.

"Sharon L." <SharonL@discussions.microsoft.com> wrote in message 
news:93F83869-436F-4307-9CA1-974B0BC30C87@microsoft.com...
> 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!
>
> "Doug Robbins - Word MVP" wrote:
>
>> 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
>>
>> "Sharon L." <SharonL@discussions.microsoft.com> wrote in message
>> news:AC8526BE-D578-472D-BFF1-75B2E398ACB4@microsoft.com...
>> > 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!
>> 

0
Doug
12/22/2009 9:20:51 PM
Reply:

Similar Artilces:

Macro warning with no macros
I have a workbook that when I try to open it I get the warning tellin me it contains macros and asking whether I want to Enable or Disabl them. I put no macros, no VB scripts, nothing at all in the workboo other than standard Excel formulas and some charts. I developed it i Excel 2002, SP-2, but have moved it back and forth between tw computers, the other which has Excel 97. Regardless of whether Enable or Disable or change the security settings so as not to get th warning, once the workbook is open even if I go t Tools-Macro-Macros... it lists no macros. How can I find out what's cau...

Setting default email fonts
We are running Exchange 2003/SP2 and the clients are running Outlook 2003/SP3. Is it possible to change the default fonts that the users see in Outlook on the Exchange server itself? Or it requires us to go to each user's desk to change the fonts? thanks. On Fri, 7 May 2010 08:29:01 -0700, wli2k2 <wli2k2@discussions.microsoft.com> wrote: >We are running Exchange 2003/SP2 and the clients are running Outlook 2003/SP3. > >Is it possible to change the default fonts that the users see in Outlook on >the Exchange server itself? Or it requires us to go to e...

Macro
Can anybody tell me how to kick off a macro automatically as file is opened? Regards ...

Database is not listed in ODBC to default
Hi! I am trying to create a ODBC and default the Database in order for this ODBC to use in Crysral Reports, but I could see all Databases except the one I am looking for. I am using Windows Authentication and Namedpipes in the settings and necessary access has been given in SQL for this Windows user. I've tried even creating a new ODBC, it doesn't show the database that I'm looking for. Does any one experienced this before? Regards, Venkata N M Punugu If you are using Windows authentication, make sure the Windows user is added to the database. -- Charles Allen, MVP ...

Macro
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: intel Hi, I'm thinking of buying Mac: Office 2008, but before I do I want to check that I will be able to download Scritpsmart collection of templates without any glitches: <http://www.bbc.co.uk/writersroom/scriptsmart/faq.shtml> Does anyone know if I can do this? Regards, SP. In article <ee98ff5.-1@webcrossing.caR9absDaxw>, StregaItalia@officeformac.com wrote: > Version: 2008 > Operating System: Mac OS X 10.4 (Tiger) > Processor: intel > > Hi, > > I'm thinking of buying Mac: Of...

Terminal Server based Outlook 2007 printing hieroglyphics
We are running terminal services(Server 2008 R2) with Outlook 2007 installed (SP2). No other Office components are installed. When printing emails, (all other printing is fine), the text becomes compressed and looks like hieroglyphics. 1. I have tried removing all printer drivers and re-installing the drivers with no luck. 2. I have also applied the lastest patches and Service packs to the server and Outlook. 3. I have tried using different types of drivers with each printer ie. PS, MS, PCL5e, PCL6 etc with no luck. Any help would be appreciated as users are getting very fr...

Run macro automatically.
How do I make a macro run automatically when a worksheet it is attached to is loaded? right click on the sheet tab>view code>left window worksheet>right window activate -- Don Guillett SalesAid Software donaldb@281.com "Excel macro" <Excel macro@discussions.microsoft.com> wrote in message news:DD7AF1E3-9263-4523-AC49-A43ABA1AB9D0@microsoft.com... > How do I make a macro run automatically when a worksheet it is attached to is > loaded? I am unable to find "activate " when I right click on worksheet. ( i assume that you are referring to the windo...

Help with macro/and or formula?
Perhaps this is a silly question, but i just can't figure out how t format this worksheet. The problem is that a lot of the cells hav numbers in them with negative signs in the back instead of in the fron (ie. 23-) and i was wondering if anyone knew of a macro/formula i coul use to quickly fix this problem for all the cells. I would b extremely grateful. Thanks -- brefed1 ----------------------------------------------------------------------- brefed15's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3557 View this thread: http://www.excelforum.com/showthre...

Default pricelist
Is it possible to have a default value in the pricelist field (pricelistid)? In our company we don't use the pricelist, because we have about 10.000 products. I have created a default pricelist. Everytime I create a new product in the pricelist - for instance "price project x" You can set the pricelist by using javascript when opening the product form. Keep in mind that you should only fill this field when the formtype is set to create. Hope this helps, -- Ronald Lemmen - MSCRM MVP Avanade Netherlands http://ronaldlemmen.blogspot.com/ "Harm Vestjens" wrote: ...

Attached Toolbars Macros
Excel 2003 I have a custom tool bar, this tool bar has several items, each item is pointing to a VBA code. This tool bar is attached to the worksheet. I've copied this spreadsheet to several computers. After I copied the spreadsheet I decided to rename the spreadsheet, after I renamed the spreadsheet the Toolbar Item's macros were still pointing to the old name, I reasigned each tool bar item to the current spreadsheet, saved the spreadsheet and everything was working on my computer, but when I re-copied the new spreadsheet to other computers and I clicked on the Toolbar Item...

Printing checks without printing EFT's
We pay vendors using mostly EFT's but still pay some via check. First we run EFT's and then run checks separately. However sometimes the check batch also includes EFT's thus we need a method to select checks only. Question is how can I select only the check vendors for payment. When paying via EFT, there is a selection for "EFT Only" but no such selection for "Checks Only". Is there a way around this issue? Doug Hi Doug I was browsing and saw this, we had a similar scenario We solved it by using payment priority within the creditor (under options) ...

Protected sheets and running macros
i have a sheet with a macro ran by a normal button at the top. Howeve when i protect the worksheet where ever i click on the sheet the macr executes. Can any one offer any advice on how to stop this? Thanks Robert -- Message posted from http://www.ExcelForum.com hi, i am not able to reproduce the problem, hence i may not be able t provide a panacea for that issue. here is what i suggest. i have a sheet that has a macro that is run when a control toolbo button (that is, not a form button) is clicked. this sheet is protected based on the user logged in. what i have don is to protect t...

Banding when printing Gradients in Excel 2007
I use complex spreadsheets with macros to report company sales data. The reports were created in Excel 2002. When I print the charts from 2002, they print fine... text is crisp and gradients are gradients. When I print the same charts in Excel 2007, the gradients don't print. Rather I get a series of four distinct color bands. The lines and text are also not crisp but rather jagged. We use a color "powerhouse" laser printer -- Gestener aka Ricoh (too many copies to print on an inkjet). Has anyone had this problem? Anyone know of a fix? ...

Macro to remove rows?
Hi, I receive thousands of rows of data from an extract that comes from a database. The data extract automatically generates page headers that need to be removed, and I would love to automate this process. The headers do have a pattern to them, but I'm not clever enough to figure out a good way to use that to write a macro. The first row of the header starts with hyphens ------------------------------- Then there's a variable number of rows of header data to delete followed by another row of hyphens ------------------------------- Then 2 additional rows that must be deleted. The nu...

Macro Freezes Reading Pane
I have a macro that Sends/Receives Tasks from Project Server into Outlook Tasks. Everything is working fine, except one weird thing that happens. I have the Timer set on the macro and it starts as soon as Outlook starts. The macro gets the tasks from ProjectServer every hour. As soon as the macro starts running the Reading pane freezes in the Inbox. If i stop the macro then Reading pane is back to normal. Can anyone please tell me if there is something I can do in VBA to fix this annoying issue. Thanks a lot ...

Calling on a macro within a macro!
Hey All!! Quick Question - How do you call up a macro within a current macro? I have one big macro and I need it to jump to several other macros when it runs! Does it matter where the other macros are stored or is it better to have them all in one module? Help appreciated Thnx! Hi Mellowe, '=============>> Public Sub Main() 'Your code Call One 'your code End Sub '<<============= '=============>> Public Sub One() MsgBox "Hi from One" End Sub '<<============= > Does it matter where the other macros are stored or ...

How do I get my publisher 2003 documents to print to the edge of .
How can I get documents to print to the edge of a page in Publisher 2003? I want my picture to bleed to the edge and have set all gaps to 0. Yet I still get a big white border around each side of the page as opposed to the graphics printing to the edge. Ple Is your printer capable of doing that? Not all are. -- JoAnn Paules MVP Microsoft [Publisher] "Macey" <Macey@discussions.microsoft.com> wrote in message news:C4FA27CF-D2F2-47E7-B35D-D100ABF3B70A@microsoft.com... > How can I get documents to print to the edge of a page in Publisher 2003? > I > want my pi...

receipt printing #5
How do I print a receipt prior to tendering? I know that you can create a Quote and then print, but what a mess. ...

limit posting to default accounts
We are going through a major overhaul of our General Ledger and are marking accounts "Inactive" and do not "Allow Account Entry". However, if the account number we inactivated was stored in a recurring batch or as a default posting account in the vendor cards, transactions are accepted and can be posted to these "inactive" accounts without warnings or errors. Apparently, the flags are checked when the number is physically entered into a transaction entry window and not at posting. Our suggestion is that an additional check be performed at post to see if t...

Top margin shifts when viewed in print preview
This happened in Pub 97. Just installed Pub 2003, same thing. An 8.5 x 11 landscape page with margin guides all set at .2 inches (for Minolta 3300), also vertical and horizontal ruler guides and grid guides set at 2 columns and rows spaced at .4 inches. The same graphic is in each quadrant filling the bordered area. (Four postcards with an even border when the page is cut into quarters). Looks great until I view the print preview or print it, then it views and prints with a top margin of 6mm or about .25 inch. I don't think it's my printer properties, as I have printed it ...

Change default "Show names from the:" option
Clicking the "To:" button in a new Outlook email message brings up the "Select Names" dialog box. This dialog displays the contents of contact databases such as My Outlook Address Book and Global Address List. Is there a way to change the default database selected in the "Show names from the:" line from the current Global Address List to the contacts in my Outlook Address Book? My version of Outlook connects with an Exchange server to acces mail, contacts, etc. Thanks for any suggestions, Kerry You probably meant to post your Outlook version so we coul...

shortcut keys to macros
Hi, Is it at all possible to assign shortcut keys to macros in Outlook? Thx, Hans ...

Can i print copy numbers?
At my job we must print copies of databases and keep track of them. We only print 100 copies at a time. Is there a way to make it automaticly put "1 of 100" or "copy 1 of 100" in the footer?? You could run a little macro: Option Explicit Sub testme() Dim iCtr As Long For iCtr = 1 To 3 '100 when you're ready With ActiveSheet .PageSetup.RightFooter = "Copy " & iCtr & " of 100" .PrintOut preview:=True 'false when you're ready End With Next iCtr End Sub I used 1 to 3 and pri...

How do you print the membership of a distribution group in E2k3
How do you print the membership of a distribution group in E2k3 In 5.5, there was the awkward workaround to "add (or remove) a member, then highlight all the users from their and copy them to the clipboard and paste them in a text file. Don't see "export contents" - You can but it's blank. Don't see any way to get to a copyable list. What am I missing? believe it or not, the easiest way is via Outlook... Create a new meeting request...select the group to invite. Then "expand" the group in the attendee availability window. Then select all of the membe...

help Unable to record Macro !!!!!!!
I want to record a macro in excel.But as soon as I click record Macro it says "unable to record" macro. Got no help in excel help.I do this same thing in word and it's working. Please help It's urgent for me !!!1 Have a look here http://groups.google.com/groups?as_epq=unable%20to%20record&as_ugroup=microsoft.public.excel.* -- Don Guillett SalesAid Software donaldb@281.com "ash" <anonymous@discussions.microsoft.com> wrote in message news:3e0b01c42ae5$45333e00$a401280a@phx.gbl... > I want to record a macro in excel.But as soon as I click > record...