PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Saving Attachments using VBA and parsing information from subject/body

Reply

Saving Attachments using VBA and parsing information from subject/body

 
Thread Tools Rate Thread
Old 12-12-2006, 03:52 PM   #1
rligouri@allwaysforwarding.com
Guest
 
Posts: n/a
Default Saving Attachments using VBA and parsing information from subject/body


I am working on some code to automatically save attachments based on
information in the email message. I have found plenty on information on
the basics of saving attachments, but I am looking to get a little more
advanced. First off, I want to stay away from rules all together and do
it entirely in VBA if possible. What I want to do is if certain
"triggers" are contained in the subject or body, then the attachments
will be saved to the local drive. I haven't decide yet what i will use
as the trigger, but lets just say if the subject or body contained the
phrase "%%SAVE", using the next 10 characters after that phrase, the
file(s) will be saved to a directory named whatever those 10 characters
are. Is it possible to use VBA to seach the subject or body for that
trigger? I want it so the trigger can be located anywhere and not in a
specfic place like the begining of the text. Thanks in advance.

  Reply With Quote
Old 12-12-2006, 04:12 PM   #2
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Saving Attachments using VBA and parsing information from subject/body

You would have to save the attachment to the drive first, then use the methods of the application appropriate for each type of file to search its content. All that can be done in VBA, but the only Outlook portion of the project is saving the attachment to the file system.

--
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

<rligouri@allwaysforwarding.com> wrote in message news:1165938722.781428.234210@16g2000cwy.googlegroups.com...
>I am working on some code to automatically save attachments based on
> information in the email message. I have found plenty on information on
> the basics of saving attachments, but I am looking to get a little more
> advanced. First off, I want to stay away from rules all together and do
> it entirely in VBA if possible. What I want to do is if certain
> "triggers" are contained in the subject or body, then the attachments
> will be saved to the local drive. I haven't decide yet what i will use
> as the trigger, but lets just say if the subject or body contained the
> phrase "%%SAVE", using the next 10 characters after that phrase, the
> file(s) will be saved to a directory named whatever those 10 characters
> are. Is it possible to use VBA to seach the subject or body for that
> trigger? I want it so the trigger can be located anywhere and not in a
> specfic place like the begining of the text. Thanks in advance.
>

  Reply With Quote
Old 12-12-2006, 07:30 PM   #3
rligouri@allwaysforwarding.com
Guest
 
Posts: n/a
Default Re: Saving Attachments using VBA and parsing information from subject/body

I'm sorry. I should have went into more detail. I dont need to search
in the attachment for the trigger just the body or subject of the email
message.

Sue Mosher [MVP-Outlook] wrote:
> You would have to save the attachment to the drive first, then use the methods of the application appropriate for each type of file to search its content. All that can be done in VBA, but the only Outlook portion of the project is saving the attachment to the file system.
>
> --
> 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
>
> <rligouri@allwaysforwarding.com> wrote in message news:1165938722.781428.234210@16g2000cwy.googlegroups.com...
> >I am working on some code to automatically save attachments based on
> > information in the email message. I have found plenty on information on
> > the basics of saving attachments, but I am looking to get a little more
> > advanced. First off, I want to stay away from rules all together and do
> > it entirely in VBA if possible. What I want to do is if certain
> > "triggers" are contained in the subject or body, then the attachments
> > will be saved to the local drive. I haven't decide yet what i will use
> > as the trigger, but lets just say if the subject or body contained the
> > phrase "%%SAVE", using the next 10 characters after that phrase, the
> > file(s) will be saved to a directory named whatever those 10 characters
> > are. Is it possible to use VBA to seach the subject or body for that
> > trigger? I want it so the trigger can be located anywhere and not in a
> > specfic place like the begining of the text. Thanks in advance.
> >


  Reply With Quote
Old 12-12-2006, 07:56 PM   #4
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Saving Attachments using VBA and parsing information from subject/body

In that case, you can use the Instr() function to parse the Subject or Body property.

--
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

<rligouri@allwaysforwarding.com> wrote in message news:1165951824.878064.19330@80g2000cwy.googlegroups.com...
> I'm sorry. I should have went into more detail. I dont need to search
> in the attachment for the trigger just the body or subject of the email
> message.
>
> Sue Mosher [MVP-Outlook] wrote:
>> You would have to save the attachment to the drive first, then use the methods of the application appropriate for each type of file to search its content. All that can be done in VBA, but the only Outlook portion of the project is saving the attachment to the file system.
>>
>> --
>> 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
>>
>> <rligouri@allwaysforwarding.com> wrote in message news:1165938722.781428.234210@16g2000cwy.googlegroups.com...
>> >I am working on some code to automatically save attachments based on
>> > information in the email message. I have found plenty on information on
>> > the basics of saving attachments, but I am looking to get a little more
>> > advanced. First off, I want to stay away from rules all together and do
>> > it entirely in VBA if possible. What I want to do is if certain
>> > "triggers" are contained in the subject or body, then the attachments
>> > will be saved to the local drive. I haven't decide yet what i will use
>> > as the trigger, but lets just say if the subject or body contained the
>> > phrase "%%SAVE", using the next 10 characters after that phrase, the
>> > file(s) will be saved to a directory named whatever those 10 characters
>> > are. Is it possible to use VBA to seach the subject or body for that
>> > trigger? I want it so the trigger can be located anywhere and not in a
>> > specfic place like the begining of the text. Thanks in advance.
>> >

>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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