A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

vba macro to print email and attachments outlook 2000



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 5th 06, 06:05 PM posted to microsoft.public.outlook.program_vba
Dan over in IT
external usenet poster
 
Posts: 2
Default vba macro to print email and attachments outlook 2000

Hi All,

I'm writing a macro in vba for Outlook 2000. My users need to print an
email with all of it's attachments, and then flag the email for follow
up. I have the flagging all set, and the email prints with most of the
attachments. However, if there are 2+ excel files attached (i've only
noticed this with Excel) one of them will not print. It seems like
excel doesn't open and print fast enough to get to all of them, so one
of them is just skipped. Has anyone else experienced this problem, and
if so is there any way around it??

Thanks

Ads
  #2  
Old June 6th 06, 08:12 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default vba macro to print email and attachments outlook 2000

Show your code for printing the attachments?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Dan over in IT" wrote in message oups.com...
Hi All,

I'm writing a macro in vba for Outlook 2000. My users need to print an
email with all of it's attachments, and then flag the email for follow
up. I have the flagging all set, and the email prints with most of the
attachments. However, if there are 2+ excel files attached (i've only
noticed this with Excel) one of them will not print. It seems like
excel doesn't open and print fast enough to get to all of them, so one
of them is just skipped. Has anyone else experienced this problem, and
if so is there any way around it??

Thanks

  #3  
Old June 7th 06, 09:08 PM posted to microsoft.public.outlook.program_vba
Dan over in IT
external usenet poster
 
Posts: 2
Default vba macro to print email and attachments outlook 2000

Hi Sue,

Public Sub PrintSelectedEmails()

Dim oOutlook As Outlook.Application
Dim oNamespace As Outlook.NameSpace
Dim oMailItem As Outlook.MailItem
Dim i As Long

Set oNamespace = Application.GetNamespace("MAPI")
For i = 1 To Application.ActiveExplorer.Selection.Count
Set oMailItem = Application.ActiveExplorer.Selection.Item(i) '
Select the selected item to flag it
oMailItem.FlagStatus = olFlagMarked ' Marks the flag
oMailItem.FlagRequest = "Follow up" ' Sets flag for follow up
oMailItem.Close olSave ' Saves the flag and closes
the message

Set oMailItem = Application.ActiveExplorer.Selection.Item(i) '
Select the selected item to print it
oMailItem.Body = oMailItem.Body ' modifying the body of the mail
item reformats it to Rich Text
oMailItem.PrintOut ' Print's out email using users preference
' For this to work properly with attachments,
users must specify so in print options
Pause (oMailItem.Attachments.Count)
oMailItem.Close (olDiscard) ' don't save the email in Rich Text
format, preserve original format

Next i

Set oMailItem = Nothing
Set oNamespace = Nothing

End Sub

There is my function, the pause routine just waits 3 * the number
passed in seconds and I did that so that the attachments would print at
least grouped with the email, instead of all the emails, then all the
attachments in random order. I've tried printing then flagging, so
that I only have to set the item once, but I change the format because
of the HTML issue, and I'm trying not to save it in RTF if I can avoid
that...

Thanks in advance for any help you can give.

Dan

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Code to put in Access that will send an Email with Attachments [email protected] Outlook and VBA 1 April 9th 06 06:30 PM
Automatically trigger a VBA macro to run when connection to exchange server has been made. [email protected] Outlook and VBA 1 January 30th 06 11:29 PM
Automatically trigger a VBA macro to run when connection to exchange server has been made. [email protected] Outlook and VBA 0 January 25th 06 09:52 PM
put macro into MS Outlook 2000 David C Outlook and VBA 4 January 25th 06 06:00 PM
Outlook 2000 - Button to run Macro then open Database David C Outlook and VBA 1 January 25th 06 04:44 PM


All times are GMT +1. The time now is 04:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.