Home All Groups Group Topic Archive Search About
Author
7 Feb 2005 8:46 AM
Michelle M
Hi

I am quite new to Outlook programming but am familiar with Access
programming, just having a little difficulty tying the two together.

I need to do the following:
1. User opens a specific message type (eg: seminar bookings).

2. User presses a custom icon on toolbar (or preferably fire upon the Read
event) which will send specific information from open message to a text
file.
Within the message, I only need to read from a certain area, delineated by
[start] and ending with [finish].

**Not sure how to go about this.  Is there a function where I can read lines
from the message and place into a text file??**

3. Read the textfile and import it into Access. (this I can do)

I am just having trouble with getting a Read event to fire. Do I need to
create a new class module of just put the Read event in a normal module?

TIA
Michelle
* Please only reply to newsgroup *

Author
7 Feb 2005 12:41 PM
Sue Mosher [MVP-Outlook]
By "specific message type," do you mean an Outlook custom form? If so, the
event you're looking for is Open:

Function Item_Open()
    MsgBox "You opened this item"
End Function

The item property that holds the text is the Body property.

Use FileSystemObject methods to work with the text file.

Do you really need the text file, though? Why not just send the data to
Access directly?
--
Sue Mosher, Outlook MVP
Author of
     Microsoft Outlook Programming - Jumpstart for
     Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx


Show quote
"Michelle M" <tnt-em***@netspace.net.au> wrote in message
news:cu7a5a$2isd$1@otis.netspace.net.au...
> Hi
>
> I am quite new to Outlook programming but am familiar with Access
> programming, just having a little difficulty tying the two together.
>
> I need to do the following:
> 1. User opens a specific message type (eg: seminar bookings).
>
> 2. User presses a custom icon on toolbar (or preferably fire upon the Read
> event) which will send specific information from open message to a text
> file.
> Within the message, I only need to read from a certain area, delineated by
> [start] and ending with [finish].
>
> **Not sure how to go about this.  Is there a function where I can read
> lines from the message and place into a text file??**
>
> 3. Read the textfile and import it into Access. (this I can do)
>
> I am just having trouble with getting a Read event to fire. Do I need to
> create a new class module of just put the Read event in a normal module?
>
> TIA
> Michelle
> * Please only reply to newsgroup *
>
>
>
>
>
Author
7 Feb 2005 9:39 PM
Michelle M
Hi Sue

Thanks for your response.

No, the form is just a normal message type of form.  It contains normal text
as any message would except at the bottom of the message, there is a section
which is the only information that I need to syphon off.  This area starts
and stops with [START] and [FINISH].  That is why I only need to get part of
the message.

There will be more than one of these type of messages in the In Box, as each
will contain seminar booking information which interested people register
via the web. This is when the email is generated.

1. Yes, I agree sending the relevant part of the message directly to a
temporary access table is a good idea, but I'm unsure at this point how to
get it there from Outlook.

2. I have tried using FileSystemObject but it won't compile. It doesn't come
up as a type selectable.  How can I change this?

3. I have played around with the Read event, but cannot get it to fire up
upon reading, only if I assign a custom button first and then press it.  Is
that how it is supposed to work?

Thanks so much for your help so far.
Michelle


Show quote
"Sue Mosher [MVP-Outlook]" <sue***@outlookcode.com> wrote in message
news:%23UpwCZRDFHA.3368@TK2MSFTNGP10.phx.gbl...
> By "specific message type," do you mean an Outlook custom form? If so, the
> event you're looking for is Open:
>
> Function Item_Open()
>    MsgBox "You opened this item"
> End Function
>
> The item property that holds the text is the Body property.
>
> Use FileSystemObject methods to work with the text file.
>
> Do you really need the text file, though? Why not just send the data to
> Access directly?
> --
> Sue Mosher, Outlook MVP
> Author of
>     Microsoft Outlook Programming - Jumpstart for
>     Administrators, Power Users, and Developers
>     http://www.outlookcode.com/jumpstart.aspx
>
>
> "Michelle M" <tnt-em***@netspace.net.au> wrote in message
> news:cu7a5a$2isd$1@otis.netspace.net.au...
>> Hi
>>
>> I am quite new to Outlook programming but am familiar with Access
>> programming, just having a little difficulty tying the two together.
>>
>> I need to do the following:
>> 1. User opens a specific message type (eg: seminar bookings).
>>
>> 2. User presses a custom icon on toolbar (or preferably fire upon the
>> Read event) which will send specific information from open message to a
>> text file.
>> Within the message, I only need to read from a certain area, delineated
>> by [start] and ending with [finish].
>>
>> **Not sure how to go about this.  Is there a function where I can read
>> lines from the message and place into a text file??**
>>
>> 3. Read the textfile and import it into Access. (this I can do)
>>
>> I am just having trouble with getting a Read event to fire. Do I need to
>> create a new class module of just put the Read event in a normal module?
>>
>> TIA
>> Michelle
>> * Please only reply to newsgroup *
>>
>>
>>
>>
>>
>
>
Author
8 Feb 2005 12:00 PM
Sue Mosher [MVP-Outlook]
> No, the form is just a normal message type of form.  It contains normal
> text as any message would except at the bottom of the message, there is a
> section which is the only information that I need to syphon off.  This
> area starts and stops with [START] and [FINISH].  That is why I only need
> to get part of the message.

You might find the code sample at
http://www.outlookcode.com/codedetail.aspx?id=89 useful. It's a basic
exercise in extracting text from a structured text block.

> There will be more than one of these type of messages in the In Box, as
> each will contain seminar booking information which interested people
> register via the web. This is when the email is generated.

If there's a way to distinguish these, your macro can use a
MAPIFolder.Items.FInd or .Restrict statement to get those specific items.

> 1. Yes, I agree sending the relevant part of the message directly to a
> temporary access table is a good idea, but I'm unsure at this point how to
> get it there from Outlook.

You'd need to write the ADO code to do this. See
http://www.outlookcode.com/d/database.htm

> 2. I have tried using FileSystemObject but it won't compile. It doesn't
> come up as a type selectable.  How can I change this?

Did you add a reference to your project to the Microsoft Scripting Runtime
library?

> 3. I have played around with the Read event, but cannot get it to fire up
> upon reading, only if I assign a custom button first and then press it.
> Is that how it is supposed to work?

If you don't have a custom form and you want to do something when the user
opens an item, you need to use Inspectors.NewInspector event. But as I said,
the Find and Restrict methods may be more appropriate for your project.

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

Show quote
>
>
> "Sue Mosher [MVP-Outlook]" <sue***@outlookcode.com> wrote in message
> news:%23UpwCZRDFHA.3368@TK2MSFTNGP10.phx.gbl...
>> By "specific message type," do you mean an Outlook custom form? If so,
>> the event you're looking for is Open:
>>
>> Function Item_Open()
>>    MsgBox "You opened this item"
>> End Function
>>
>> The item property that holds the text is the Body property.
>>
>> Use FileSystemObject methods to work with the text file.
>>
>> Do you really need the text file, though? Why not just send the data to
>> Access directly?
>> --
>> Sue Mosher, Outlook MVP
>> Author of
>>     Microsoft Outlook Programming - Jumpstart for
>>     Administrators, Power Users, and Developers
>>     http://www.outlookcode.com/jumpstart.aspx
>>
>>
>> "Michelle M" <tnt-em***@netspace.net.au> wrote in message
>> news:cu7a5a$2isd$1@otis.netspace.net.au...
>>> Hi
>>>
>>> I am quite new to Outlook programming but am familiar with Access
>>> programming, just having a little difficulty tying the two together.
>>>
>>> I need to do the following:
>>> 1. User opens a specific message type (eg: seminar bookings).
>>>
>>> 2. User presses a custom icon on toolbar (or preferably fire upon the
>>> Read event) which will send specific information from open message to a
>>> text file.
>>> Within the message, I only need to read from a certain area, delineated
>>> by [start] and ending with [finish].
>>>
>>> **Not sure how to go about this.  Is there a function where I can read
>>> lines from the message and place into a text file??**
>>>
>>> 3. Read the textfile and import it into Access. (this I can do)
>>>
>>> I am just having trouble with getting a Read event to fire. Do I need to
>>> create a new class module of just put the Read event in a normal module?
>>>
>>> TIA
>>> Michelle
>>> * Please only reply to newsgroup *
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>
Author
8 Feb 2005 9:22 PM
Michelle M
Thank you so much for your information Sue. I will now follow those links
up.

Michelle



Show quote
"Sue Mosher [MVP-Outlook]" <sue***@outlookcode.com> wrote in message
news:%23JbxpbdDFHA.3120@TK2MSFTNGP15.phx.gbl...
>> No, the form is just a normal message type of form.  It contains normal
>> text as any message would except at the bottom of the message, there is a
>> section which is the only information that I need to syphon off.  This
>> area starts and stops with [START] and [FINISH].  That is why I only need
>> to get part of the message.
>
> You might find the code sample at
> http://www.outlookcode.com/codedetail.aspx?id=89 useful. It's a basic
> exercise in extracting text from a structured text block.
>
>> There will be more than one of these type of messages in the In Box, as
>> each will contain seminar booking information which interested people
>> register via the web. This is when the email is generated.
>
> If there's a way to distinguish these, your macro can use a
> MAPIFolder.Items.FInd or .Restrict statement to get those specific items.
>
>> 1. Yes, I agree sending the relevant part of the message directly to a
>> temporary access table is a good idea, but I'm unsure at this point how
>> to get it there from Outlook.
>
> You'd need to write the ADO code to do this. See
> http://www.outlookcode.com/d/database.htm
>
>> 2. I have tried using FileSystemObject but it won't compile. It doesn't
>> come up as a type selectable.  How can I change this?
>
> Did you add a reference to your project to the Microsoft Scripting Runtime
> library?
>
>> 3. I have played around with the Read event, but cannot get it to fire up
>> upon reading, only if I assign a custom button first and then press it.
>> Is that how it is supposed to work?
>
> If you don't have a custom form and you want to do something when the user
> opens an item, you need to use Inspectors.NewInspector event. But as I
> said, the Find and Restrict methods may be more appropriate for your
> project.
>
> --
> Sue Mosher, Outlook MVP
> Author of
>     Microsoft Outlook Programming - Jumpstart for
>     Administrators, Power Users, and Developers
>     http://www.outlookcode.com/jumpstart.aspx
>
>>
>>
>> "Sue Mosher [MVP-Outlook]" <sue***@outlookcode.com> wrote in message
>> news:%23UpwCZRDFHA.3368@TK2MSFTNGP10.phx.gbl...
>>> By "specific message type," do you mean an Outlook custom form? If so,
>>> the event you're looking for is Open:
>>>
>>> Function Item_Open()
>>>    MsgBox "You opened this item"
>>> End Function
>>>
>>> The item property that holds the text is the Body property.
>>>
>>> Use FileSystemObject methods to work with the text file.
>>>
>>> Do you really need the text file, though? Why not just send the data to
>>> Access directly?
>>> --
>>> Sue Mosher, Outlook MVP
>>> Author of
>>>     Microsoft Outlook Programming - Jumpstart for
>>>     Administrators, Power Users, and Developers
>>>     http://www.outlookcode.com/jumpstart.aspx
>>>
>>>
>>> "Michelle M" <tnt-em***@netspace.net.au> wrote in message
>>> news:cu7a5a$2isd$1@otis.netspace.net.au...
>>>> Hi
>>>>
>>>> I am quite new to Outlook programming but am familiar with Access
>>>> programming, just having a little difficulty tying the two together.
>>>>
>>>> I need to do the following:
>>>> 1. User opens a specific message type (eg: seminar bookings).
>>>>
>>>> 2. User presses a custom icon on toolbar (or preferably fire upon the
>>>> Read event) which will send specific information from open message to a
>>>> text file.
>>>> Within the message, I only need to read from a certain area, delineated
>>>> by [start] and ending with [finish].
>>>>
>>>> **Not sure how to go about this.  Is there a function where I can read
>>>> lines from the message and place into a text file??**
>>>>
>>>> 3. Read the textfile and import it into Access. (this I can do)
>>>>
>>>> I am just having trouble with getting a Read event to fire. Do I need
>>>> to create a new class module of just put the Read event in a normal
>>>> module?
>>>>
>>>> TIA
>>>> Michelle
>>>> * Please only reply to newsgroup *
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
12 Feb 2005 3:45 AM
-Michelle-
Sue

I have a question in relation to your reply.

Where you said:
> If there's a way to distinguish these, your macro can use a
> MAPIFolder.Items.FInd or .Restrict statement to get those specific items.

Yes, I can distinguish these messages in the inbox as they will have one of
two specific headings as the subject.
1. Is that enough to find them and then determine if they have been read or
not?

2. The user wants the control in the message level, upon viewing, press
customised button in message menu.

I want from the READ Event of the button/message to find the message that is
currently being read from the linked table to Outlook (which you gave a code
sample for). Thanks! :) and syphone off that 'body' information  Only read
that information and send relevant data to temporary access table, coding
that from within Access. I hope i have explained myself adequately.

The question is : is it possible to distinguish the current record based on
the mail currently being read from the INBOX table linked to Outlook?

Thanks so much for your help so far.

Michelle
**Please only reply to newsgroup**
Author
12 Feb 2005 1:49 PM
Sue Mosher [MVP-Outlook]
1) Certainly, if you loop through all the items in the folder. Find and
Restrict can do only exact match and "starting with" searches, not
"contains" searches, so otherwise it depends on the placement of the
information in the subject.

2) I'm afraid you lost me on #2, in large part because you didn't quote any
of the previous conversation. But nothing in the Access linked table will
tell you what message the user has selected or opened in Outlook.

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


Show quote
"-Michelle-" <milkysw***@yahoo.com> wrote in message
news:cuju45$qh3$1@otis.netspace.net.au...
> Sue
>
> I have a question in relation to your reply.
>
> Where you said:
>> If there's a way to distinguish these, your macro can use a
>> MAPIFolder.Items.FInd or .Restrict statement to get those specific items.
>
> Yes, I can distinguish these messages in the inbox as they will have one
> of two specific headings as the subject.
> 1. Is that enough to find them and then determine if they have been read
> or not?
>
> 2. The user wants the control in the message level, upon viewing, press
> customised button in message menu.
>
> I want from the READ Event of the button/message to find the message that
> is currently being read from the linked table to Outlook (which you gave a
> code sample for). Thanks! :) and syphone off that 'body' information  Only
> read that information and send relevant data to temporary access table,
> coding that from within Access. I hope i have explained myself adequately.
>
> The question is : is it possible to distinguish the current record based
> on the mail currently being read from the INBOX table linked to Outlook?
>
> Thanks so much for your help so far.
>
> Michelle
> **Please only reply to newsgroup**
>
Author
12 Feb 2005 7:22 PM
Jim Vierra
Just a thought, hope it might be of some value.

If you are using Office 2002/2003 you can use Access to extract mail from
any folder in an Outlook PST.

In Access use either the Outlook() data connector or the Exchange()
connector.  These ADO sources will allow access to Outlook folders and
Exchange mailboxes.  It is even possible to build a kludged mail client with
Access.  Another interesting side effect is that it does not trigger the
Security Guard like direct access to the Outlook object does.

Once in Access you have the full power of Access SQL to search the fields
for items of interest.
Sometimes this technique can give you the desired outcome but may not work
for all cases.  Sue would be able to describe the limitations better than I
can.

Here are the columns available - notice the "Content Unread" column.
            Name
Type                               Size

            Importance
Long Integer                                        4

            Icon
Text                                               255

            Priority
Long Integer                                        4

            Subject
Text                                               255

            From
Text                                               255

            Message To Me
Yes/No                                               1

            Message CC to Me
Yes/No                                               1

            Sender Name
Text                                               255

            CC
Text                                               255

            To
Text                                               255

            Received
Date/Time                                           8

            Message Size
Long Integer                                        4

            Contents
Memo                                                 -

            Created
Date/Time                                           8

            Modified
Date/Time                                           8

            Subject Prefix
Text                                               255

            Has Attachments
Yes/No                                               1

            Normalized Subject
Text                                               255

            Object Type
Long Integer                                        4

            Content Unread
Long Integer                                        4


--
Jim Vierra
Show quote
"Sue Mosher [MVP-Outlook]" <sue***@outlookcode.com> wrote in message
news:ey91AnQEFHA.3992@tk2msftngp13.phx.gbl...
> 1) Certainly, if you loop through all the items in the folder. Find and
> Restrict can do only exact match and "starting with" searches, not
> "contains" searches, so otherwise it depends on the placement of the
> information in the subject.
>
> 2) I'm afraid you lost me on #2, in large part because you didn't quote
> any of the previous conversation. But nothing in the Access linked table
> will tell you what message the user has selected or opened in Outlook.
>
> --
> Sue Mosher, Outlook MVP
> Author of
>     Microsoft Outlook Programming - Jumpstart for
>     Administrators, Power Users, and Developers
>     http://www.outlookcode.com/jumpstart.aspx
>
>
> "-Michelle-" <milkysw***@yahoo.com> wrote in message
> news:cuju45$qh3$1@otis.netspace.net.au...
>> Sue
>>
>> I have a question in relation to your reply.
>>
>> Where you said:
>>> If there's a way to distinguish these, your macro can use a
>>> MAPIFolder.Items.FInd or .Restrict statement to get those specific
>>> items.
>>
>> Yes, I can distinguish these messages in the inbox as they will have one
>> of two specific headings as the subject.
>> 1. Is that enough to find them and then determine if they have been read
>> or not?
>>
>> 2. The user wants the control in the message level, upon viewing, press
>> customised button in message menu.
>>
>> I want from the READ Event of the button/message to find the message that
>> is currently being read from the linked table to Outlook (which you gave
>> a code sample for). Thanks! :) and syphone off that 'body' information
>> Only read that information and send relevant data to temporary access
>> table, coding that from within Access. I hope i have explained myself
>> adequately.
>>
>> The question is : is it possible to distinguish the current record based
>> on the mail currently being read from the INBOX table linked to Outlook?
>>
>> Thanks so much for your help so far.
>>
>> Michelle
>> **Please only reply to newsgroup**
>>
>
>

AddThis Social Bookmark Button