View Single Post
  #2  
Old July 3rd 07, 05:02 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default divert outlook mails after changing attachment using VBA

All that is possible:

- use the MAPIFolder.Items.ItemAdd to trap incoming mails
- use MailItem.SenderName or MailItem.SenderEmailAddress to determine
whether this is "User A"
- use MailItem.Attachments to inspect all Attachment.FileName properties for
the extension you're looking for
- use Attachment.SaveAsFile to save it to disk, then use the Name statement
to rename it
- use MailItem.Attachments.Remove and MailItem.Attachments.Add to replace
the attachment, then MailItem.Save to commit your changes
- use MailItem.Forward to redirect to other users
- use MailItem.Recipients.Add to add the other users
- call MailItem.Send

All examples above are using the actual object names for reference purposes
- use variables to create instances of these objects with your code.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"chits" wrote:

Hi,

I wish to divert all my mails that come from User A to users B & C. Also
while diverting, i need to check if the filename from 'A' is in mht format, i
wish to change the extension that to .xls & send to B & C.
Is this possible in VBA ?
i am using Microsoft outlook 2003(11.8118.8132) SP2

Thanks,

Ads