Printing macro for Outlook

G

Guest

We have several printers in our office (law firm). I would like to write a macro that will print a selected email to a specific printer. This is what I have so far

Sub HPYellow(

ActivePrinter = "Secondary
With ActiveDocument.MailIte
.FirstPageTray = 26
.OtherPagesTray = 26
End Wit
MailItem.PrintOu
End Su

It keeps returning an object error. What am I missing? This macro should just print the currently selected email to the active printer....

Thanks

Kate Goebe
Habush Habush & Rottier S.C.
 
K

Ken Slovak - [MVP - Outlook]

Once Outlook is initialized it only uses the default system printer that was
selected at the time Outlook is started. No matter what you do a
MailItem.Printout command will use that printer.

If you want to specify a printer you would have to get all your mail item
fields into Word or make sure the user is using WordMail and then use Word
code to do the printout. Since it would be Word code you can just use the
Word macro recorder to create the macro. Just use the ActiveDocument
property in that case and don't try to use the mail item itself.




Kate Goebel said:
We have several printers in our office (law firm). I would like to write a
macro that will print a selected email to a specific printer. This is what I
have so far:
Sub HPYellow()

ActivePrinter = "Secondary"
With ActiveDocument.MailItem
.FirstPageTray = 262
.OtherPagesTray = 262
End With
MailItem.PrintOut
End Sub

It keeps returning an object error. What am I missing? This macro should
just print the currently selected email to the active printer....
 
G

Guest

My problem is that the folks that set our office up hard coded all of their documents to print to a specific printer....so I had to write printing macros that direct the documents to print to a specific printer that contains a specific paper type...it takes two printers to accomodate all of our paper types. The default printer becomes the printer they last used to print...

For Example
Their default printer for email should be the Secondary. If they print a document in Word using the Primary printer, Word changes the default printer to the Primary...therefore the next time they try to print an email, it sends it to the wrong printer and prints on the wrong paper type

Perhaps I need to rewrite the Printing macros I wrote in Word, so it just directs the print job to the right printer, and do not change the default printer? I am not sure why it is changing the default printer....should that not stay the same no matter what? Here is the printing macros I wrote in Word to direct the documents to a specific printer and specific trays

Sub HPBond(

' HPBond Macr
' Macro recorded March 20, 2004 by Information System
'Sub CLetter1(

ActivePrinter = "Secondary
' The following code changes the setup for just the first sectio
With ActiveDocument.Sections(1).PageSetu
.FirstPageTray = 26
.OtherPagesTray = 26
End Wit
ActiveDocument.PrintOu
End Su

How can I change this to make it leave the default printer selected, but still get the Word documetns to print to the correct locations

Thanks for any advice you may have

-Kat
----- Ken Slovak - [MVP - Outlook] wrote: ----

Once Outlook is initialized it only uses the default system printer that wa
selected at the time Outlook is started. No matter what you do
MailItem.Printout command will use that printer

If you want to specify a printer you would have to get all your mail ite
fields into Word or make sure the user is using WordMail and then use Wor
code to do the printout. Since it would be Word code you can just use th
Word macro recorder to create the macro. Just use the ActiveDocumen
property in that case and don't try to use the mail item itself

--
Ken Slova
[MVP - Outlook
http://www.slovaktech.co
Author: Absolute Beginner's Guide to Microsoft Office Outlook 200
Reminder Manager, Extended Reminders, Attachment Option
http://www.slovaktech.com/products.ht


Kate Goebel said:
We have several printers in our office (law firm). I would like to write
macro that will print a selected email to a specific printer. This is what
have so far
 
K

Ken Slovak - [MVP - Outlook]

Well, I'm not a Wordie so you might get a different or better answer in a
Word programming group but I usually just set Word.Application.ActivePrinter
to whatever printer I want to use. I save the existing printer string, set
the printer I want and then restore the old setting if desired.




Kate Goebel said:
My problem is that the folks that set our office up hard coded all of
their documents to print to a specific printer....so I had to write printing
macros that direct the documents to print to a specific printer that
contains a specific paper type...it takes two printers to accomodate all of
our paper types. The default printer becomes the printer they last used to
print....
For Example:
Their default printer for email should be the Secondary. If they print a
document in Word using the Primary printer, Word changes the default printer
to the Primary...therefore the next time they try to print an email, it
sends it to the wrong printer and prints on the wrong paper type.
Perhaps I need to rewrite the Printing macros I wrote in Word, so it just
directs the print job to the right printer, and do not change the default
printer? I am not sure why it is changing the default printer....should that
not stay the same no matter what? Here is the printing macros I wrote in
Word to direct the documents to a specific printer and specific trays:
Sub HPBond()
'
' HPBond Macro
' Macro recorded March 20, 2004 by Information Systems
'Sub CLetter1()
'
ActivePrinter = "Secondary"
' The following code changes the setup for just the first section
With ActiveDocument.Sections(1).PageSetup
.FirstPageTray = 263
.OtherPagesTray = 263
End With
ActiveDocument.PrintOut
End Sub

How can I change this to make it leave the default printer selected, but
still get the Word documetns to print to the correct locations?
 

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

Similar Threads


Top