Reading from subject and writing to "To"

  • Thread starter Thread starter maximax_london
  • Start date Start date
M

maximax_london

I've never written a VBA macro for Outlook, so I don't know where to
begin.

I need to a macro that reads text from an external file and puts it
into the To box of the active message. The file it reads from is
dependant on the contents of the Subject line, so I need to know how
to reference this as well.

Any help would be very, very much appreciated!


Thanks!

Max
 
Hi Max.  Are you familiar with Visual Basic?  If you are a programmer I can
certainly help you build this solution.

--
Eric Legault - MVP - Outlook
MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, WSS 3
Application Development, MOSS 2007 Application Development)
Blog:http://blogs.officezealot.com/legault
Try Picture Attachments Wizard for Outlook!http://www.collaborativeinnovations.ca








- Show quoted text -


I'm very familiar with VB. I just haven't coded VBA for Outlook before
and so don't know the properties, methods, functions, etc specific to
Outlook.
 
Hi Max. ActiveInspector.CurrentItem will get you the MailItem object for
the open e-mail. MailItem.Subject will get you the subject line.

To reference an external file, use the functions from the VBA.FileSystem
class or use the TextStreamObject from the Microsoft Scripting Runtim
Library.

Eric


Hi Max. Are you familiar with Visual Basic? If you are a programmer I can
certainly help you build this solution.

--
Eric Legault - MVP - Outlook
MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, WSS 3
Application Development, MOSS 2007 Application Development)
Blog:http://blogs.officezealot.com/legault
Try Picture Attachments Wizard for
Outlook!http://www.collaborativeinnovations.ca








- Show quoted text -


I'm very familiar with VB. I just haven't coded VBA for Outlook before
and so don't know the properties, methods, functions, etc specific to
Outlook.
 
Hi Max.  ActiveInspector.CurrentItem will get you the MailItem object for
the open e-mail.  MailItem.Subjectwill get you thesubjectline.

Toreference an external file, use the functions from the VBA.FileSystem
class or use the TextStreamObject from the Microsoft Scripting Runtim
Library.

Eric

Thanks Eric,

And how do I write to the To and Cc line?


Max
 
There are MailItem.To and MailItem.CC properties that you can put addresses
in. It's best to use the MailItem.Recipients collection to add/remove
message recipients though, as you can use the Resolve method to validate the
e-mail addresses.


--
Eric Legault - MVP - Outlook
MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, WSS 3
Application Development, MOSS 2007 Application Development)
Blog: http://blogs.officezealot.com/legault
Try Picture Attachments Wizard for Outlook!
http://www.collaborativeinnovations.ca
 
Back
Top