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
 

Forum Admin

Senior Member
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.)
 

manitou13

Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.)
 

manitou13

Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I hven't tested that macro with a rule, but it might work.
 
Status
Not open for further replies.
Top