Auto processing & forwarding attachments???

  • Thread starter Thread starter alakasam
  • Start date Start date
A

alakasam

Hey guys,

I'm a newbie to VBA/Outlook 2000 programming but have experience i
other languages.

So my query is
i get sent emails throughout the day that contain a text fil
attachment, i have setup enough rules so that these emails ar
automatically moved to folders depending upon their subject line.

I need to
- take the attachments off these emails and select certain
information from within the text file
- create a new email and insert this information, which has variable
(but they are all fixed length)
- i need to send this email to a variable address that is dependen
upon which folder the email is moved to eg
folder one has a fixed forwarding address (e-mail address removed)
folder two has a fixed forwarding address (e-mail address removed)
etc.
- do all of this as automatically as is possible

I know it's a big task guys and i dont know if there is a solution ou
there that will accomplish it, but i will thankyou in advance for you
time and help, Thankyou
 
That is quite the list of requirements! You'd have to replace your rules
with custom VBA code to handle the messages you are looking for. You can
create a class that you instantiate in the Application_Startup event of the
ThisOutlookSession module to work on these messages.

Mail handling class:
--------------------

Option Explicit
Dim WithEvents NewMailItems As Outlook.Items

Private Sub Application_Quit()
Set NewMailItems = Nothing
End Sub

Private Sub Application_Startup()
Set NewMailItems =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub NewMailItems_ItemAdd(ByVal Item As Object)
'THIS WILL FIRE FOR EVERY NEW E-MAIL; YOU CAN USE THE
'Item OBJECT TO WORK WITH THE PROPERTIES OF THE E-MAIL MESSAGE
End Sub

Notes
------

Then iterate through the Item.Attachments collection to find the attachment
you want, and save it locally. You then need to write code to extract the
required information from this file (I suggest the TextStream object from
the VBScript library) and save it to a variable. Then create a new e-mail
message using the Application.CreateItem method, passing the variable to the
newly returned item's Body property. Use the Item.Recipients collection to
add your destination e-mail addresses and then send it. Lastly, use the
NewMailItems_ItemAdd event to move the message using the Move method,
passing it the necessary Folder object for the destination.

Hope this helps. I can't code the complete solution for you, but this
"recipe" should get you on the right track.
 
Is there anyone out there that can help me?

Nerds, Gurus, Techs, and Hobbyists of the world unite
:)
 
Thankyou very much for your help, i'll try the things you suggested and
post if i have any queries.


Cheers mate

Sam..
 
Back
Top