Print Macro with Page Range?

Status
Not open for further replies.
I would like to write a very simple macro to print only the first page of an email. It would seem to me that I could just insert something like:

obj.PrintOut From:=1, To:=1, Copies:=1 (Taken From Excell Macro)

OR

obj.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _

wdPrintDocumentContent, Copies:=1, Pages:="1", PageType:=wdPrintAllPages, _

ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _

False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _

PrintZoomPaperHeight:=0 (Taken From Word Macro)

into the OTM macro below, I have tried both with minimal tweaking and have had no success. As it is now possible to do File>Print>Print Range it seems that a macro could be written to preform this function. Assistnace with the proper code would be awesome.

If this is not possible, is there a way to work around this? For example a macro that would make a plain text copy, print one page, then delete the plain text copy. Maybe something that would open it in a browser print one page and then close it. Again, any help would be awesome!

Public Sub PrintMail()

Dim obj As Object

Set obj = Application.ActiveExplorer.Selection(1)

obj.Display

obj.PrintOut

End Sub
 
BTW, one Outlook developer MVP suggested sendkeys - not elegant, but can get the job done.

Code:
Sub PrintOnePage()
   SendKeys "%F", False
   SendKeys "P"
   SendKeys "{TAB 2}", True
   SendKeys "{DOWN}", True
   SendKeys "1"
   SendKeys "{ENTER}" 
 
End Sub

(Those are the send keys for 2007.)
 
Slipstick & Detr0itkid,

Good info thus far in this thread. I have a question for you two.

Essentially, I would like to have one specific folder (for example, "print_folder") in my tree to automatically print the first page on any e-mail messages in this folder that is a new message. I already have a rule set where specific e-mail messages are directed to the print_folder. But I would like to see all new mail that is dropped in print_folder automatically the first page is printed in each message.

Any thoughts?

Thanks!

-Eric
 
if you want to print it as you move the mail, try a rule that runs a script (the link to the macro Detr0itkid posted) then moves the mail. Because its a full macro and not a script, you might need to call it with a script. I'm not sure if the delay Det0itkid mentions will affect the ability of the rule to work correctly. (I have not tested it.)
 
Diane,

It would be awesome since the mail is automatically moved to a specific folder (print_folder) that it also will automatically print the first page once the mail arrives to the folder...

Thanks! :)

-Eric
 
I hven't tested that macro with a rule, but it might work.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
D VBA Macro to Print and Save email to network location Outlook VBA and Custom Forms 1
D Print Attachments only in selected emails using a macro Outlook VBA and Custom Forms 3
S Macro to print & move selected emails? Using Outlook 3
P Possible to write a macro to print all attachments with specific . Outlook VBA and Custom Forms 1
G Print email attachments when hit subfolder Outlook VBA and Custom Forms 1
U Outlook not responding when trying to print Emails Using Outlook 6
S Cannot print Contacts Using Outlook 7
G print attachment straight away; working script edit not working Outlook VBA and Custom Forms 0
P Print attachments automatically and move the mail to an existing folder called "Ted" Outlook VBA and Custom Forms 4
S CONTACT FIELD PRINT ORDER Outlook VBA and Custom Forms 1
A VBA Script - Print Date between first email in Category X and last email in Category Y Outlook VBA and Custom Forms 3
B Outlook 2016 Outlook crashes when trying to print certain emails Using Outlook 5
M Batch print without appended trail of repeated e Using Outlook 2
Witzker print-list-of-outlook-folders with sort posibility Outlook VBA and Custom Forms 7
M Custom Calendar Print Suggestions? Using Outlook 0
M Print email and, attachments sent in hyperlinks in the email Outlook VBA and Custom Forms 2
D Print attachments automatically and moves the mail to a new folder Outlook VBA and Custom Forms 9
A Day view - print appointment details Using Outlook 1
I print calendar without subject and details Using Outlook 1
oliv- property "is printed" or catching print events Outlook VBA and Custom Forms 2
I Print Automatically Attachments Outlook VBA and Custom Forms 3
Diane Poremsky Print a list of your Outlook folders Using Outlook 0
Diane Poremsky Combine and Print Multiple Outlook Calendars Using Outlook 0
B Print list of previously sent recipients Using Outlook 1
R Print email message and attachment in order Outlook VBA and Custom Forms 2
L Outlook 2002: HTML Emails Will Not Print: Please Help Using Outlook 0
A Print first page of a new email Outlook VBA and Custom Forms 7
Diane Poremsky Print Monthly or Work Week Calendars Using Outlook 0
Diane Poremsky No drop down calendars in Outlook 2010 Print Options Using Outlook 0
Diane Poremsky Print Monthly or Work Week Calendars Using Outlook 0
J Auto print PDF attachments as they arrive with certain words in subject Outlook VBA and Custom Forms 3
H Problems With Outlook 2013 VBA To Send and Print an email Outlook VBA and Custom Forms 1
D Outlook 2013 Categories won't print In color Using Outlook 2
G Calendar monthly view - Print just 3 weeks Using Outlook 5
R Can't modify Outlook view font with IE anymore (even though IE still affects print font) Using Outlook 5
M Print Attachments from another mailbox (not default) Outlook VBA and Custom Forms 2
E Outlook VBA to print attached Pdf to a fax printer and assign fax number Using Outlook 0
L Outlook 2010 Quick Print Attachment, nothing happend Using Outlook 0
C automatically print attachments Using Outlook 4
J Automatically Print PDF When They Are Received Using Outlook 4
M button to send and print emails Using Outlook 26
S How to print ONLY first line of appointments in month view? Using Outlook 1
M print free/busy schedule of an user Using Outlook 2
O For Outlook 2007 - VBA to print attachments Using Outlook 1
W Cannot print Outlook 2007 emails Using Outlook 2
R problem with incomming e-mail I am unable to print full e-mail letter Using Outlook 1
M Custom print contacts Using Outlook 2
E Can't print from Outlook on wifi network Using Outlook 0
E can't print some retail discount coupons Using Outlook 7
J calendar print setup in outlook 2010 Using Outlook 1

Similar threads

Back
Top