Print Outlook message and attachments

neveu

Board Regular
Joined
Jan 27, 2009
Messages
225
Hi forum,

i have a difficult question for you,

here is what i want to do:

i save several outlook messages in a folder. i would like to create a VBA macro that would do the following:
- for each message in the folder to print it
- for each message in the folder to print each attachment - basically excel files containing several spreadsheets : excel contains text and images; i would need these to fit to 1 page wide

do you think it's possible to do it?

thank you
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Yes, it's possible. Do you have any code written so far?

To print emails, you'll need a loop that calls the MailItem.PrintOut method on each message.

To print each attachment, you'll need to save it first by calling the MailItem.Attachments.Item(x).SaveAsFile Method. I usually save into the local temp folder (use Environ("temp") to get the path).

Then open the workbook using Excel.Workbooks.Open(filename) and call the Workbook.PrintOut Method. To fit the workbook to one page wide, you'll need to set each worksheet like this:

Code:
      Worksheet.PageSetup.Zoom = False
      Worksheet.PageSetup.FitToPagesWide = 1
      Worksheet.PageSetup.FitToPagesTall = False
 
Upvote 0
hi,

i have some macro to print the selected messages from Outlook.
i've tested it and it works.


Code:
[/FONT]
[COLOR=black][FONT=Arial]Sub PrintSelectedMessages() [/FONT][/COLOR]
[COLOR=black][FONT=Arial]Dim objItem As Object, intX As Integer [/FONT][/COLOR]
[FONT=Calibri] [/FONT]
[COLOR=black][FONT=Arial]For intX = 1 To Application.ActiveExplorer.Selection.Count [/FONT][/COLOR]
[COLOR=black][FONT=Arial]Set objItem = [/FONT][/COLOR][URL="http://help.lockergnome.com/office/printing-email-messages--ftopict448047.html#"][FONT=inherit]Application[/FONT][/URL][COLOR=black][FONT=Arial].ActiveExplorer.Selection.Item(intX) [/FONT][/COLOR]
[COLOR=black][FONT=Arial]objItem .PrintOut [/FONT][/COLOR]
[COLOR=black][FONT=Arial]Next [/FONT][/COLOR]
[COLOR=black][FONT=Arial]End Sub [/FONT][/COLOR][FONT=Calibri] [/FONT]
[FONT=Calibri]


thank you very much for your suggestions.

best regards,
neveu
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top