Home All Groups Group Topic Archive Search About

Can Outlook.Application be used to control open message windows?

Author
13 Dec 2004 1:56 PM
Phil Hollingworth

Hi

We have a VFP 8 CRM application which - amongst other things - stores links
for any client to any document relating to them on our file server. When you
go into a client record you can see instantly if there are any documents on
file relating to them and it is straight forward to add a new file to a
record if we received something via email for instance.

The physical location of the file is not too important to our users as they
simply double click any file they want to view and the file is executed in
the shell object to open it's associated viewer.

The problem I am currently trying to solve is when a user wants to attach
one or more files relating to a client to an email. Currently they have to
manually create the email and more irritatingly they then have manually
navigate to all the files they want to attach.

What I would like to be code would be some way for the user to initially
create the email as usual and then, from the client record on the
application, select the files they want to send and click a button which
some how attaches the files from their various locations into the email the
user has created.

I thought an easy way to do this would be to access some kind of object
collection in the Outlook.Application model to provide the user with a list
of the open email windows and their subjects which should enable the user
which window / message they want their files attached to.

However I cannot find any way of accessing anything other than the main
outlook window.

Does anyone have any ideas how this could be achieved?

Thanks in advance!!

Phil H
p***@wrltd.co.uk
Author
13 Dec 2004 3:32 PM
John Riddle
This is more of an Outlook question than Exchange, but if you're looking to
get a list of open email items, you have to loop through the Inspectors
collection:

Dim myInspectors As Outlook.Inspectors
Dim myInspector As Outlook.Inspector

For Each myInspector in myInspectors
    Set myMail = myInspector.CurrentItem
    For i = 1 to myMail.Attachments.Count
        msgBox myMail.Attachments.Item(1).FileName
    Next
    Set myMail = Nothing
Next
Set myInspector = Nothing
Set myInspectors = Nothing

This shows how to enumerate through the open inspectors, of coarse you'd
have to modify the code to do something like populate a listbox with the
items or process them in some way.

John


Show quoteHide quote
"Phil Hollingworth" <p***@wrltd.co.uk> wrote in message
news:41bd9f71$0$16588$cc9e4d1f@news-text.dial.pipex.com...
> Hi
>
> We have a VFP 8 CRM application which - amongst other things - stores
> links
> for any client to any document relating to them on our file server. When
> you
> go into a client record you can see instantly if there are any documents
> on
> file relating to them and it is straight forward to add a new file to a
> record if we received something via email for instance.
>
> The physical location of the file is not too important to our users as
> they
> simply double click any file they want to view and the file is executed in
> the shell object to open it's associated viewer.
>
> The problem I am currently trying to solve is when a user wants to attach
> one or more files relating to a client to an email. Currently they have to
> manually create the email and more irritatingly they then have manually
> navigate to all the files they want to attach.
>
> What I would like to be code would be some way for the user to initially
> create the email as usual and then, from the client record on the
> application, select the files they want to send and click a button which
> some how attaches the files from their various locations into the email
> the
> user has created.
>
> I thought an easy way to do this would be to access some kind of object
> collection in the Outlook.Application model to provide the user with a
> list
> of the open email windows and their subjects which should enable the user
> which window / message they want their files attached to.
>
> However I cannot find any way of accessing anything other than the main
> outlook window.
>
> Does anyone have any ideas how this could be achieved?
>
> Thanks in advance!!
>
> Phil H
> p***@wrltd.co.uk
>
>
>
>
Are all your drivers up to date? click for free checkup

Author
14 Dec 2004 10:39 AM
Phil Hollingworth
Hi John

Thanks for your response.

Your suggestion did work and I was able to access the Inspectors collection
to identify all the open email windows. However, I was unable to get full
access to these windows to insert attachments.

Any other suggestions?

Kind regards

Phil H.
p***@wrltd.co.uk

Show quoteHide quote
"John Riddle" <jriddleatsignwilsongroupnyperiodcom> wrote in message
news:#DF2QkS4EHA.3504@TK2MSFTNGP12.phx.gbl...
> This is more of an Outlook question than Exchange, but if you're looking
to
> get a list of open email items, you have to loop through the Inspectors
> collection:
>
> Dim myInspectors As Outlook.Inspectors
> Dim myInspector As Outlook.Inspector
>
> For Each myInspector in myInspectors
>     Set myMail = myInspector.CurrentItem
>     For i = 1 to myMail.Attachments.Count
>         msgBox myMail.Attachments.Item(1).FileName
>     Next
>     Set myMail = Nothing
> Next
> Set myInspector = Nothing
> Set myInspectors = Nothing
>
> This shows how to enumerate through the open inspectors, of coarse you'd
> have to modify the code to do something like populate a listbox with the
> items or process them in some way.
>
> John
>
Author
14 Dec 2004 2:02 PM
Ken Slovak - [MVP - Outlook]
Each Inspector has a CurrentItem property. That is what would have an
Attachments collection:

Dim oMail As Outlook.MailItem
Dim colAttach As Outlook.Attachments

Set oMail = oInspector.CurrentItem
Set colAttach = oMail.Attachments

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


Show quoteHide quote
"Phil Hollingworth" <p***@wrltd.co.uk> wrote in message
news:41bec2bf$0$16588$cc9e4d1f@news-text.dial.pipex.com...
> Hi John
>
> Thanks for your response.
>
> Your suggestion did work and I was able to access the Inspectors
collection
> to identify all the open email windows. However, I was unable to get full
> access to these windows to insert attachments.
>
> Any other suggestions?
>
> Kind regards
>
> Phil H.
> p***@wrltd.co.uk
Author
14 Dec 2004 2:34 PM
Phil Hollingworth
Ken

You are a star - thanks very much!

Kind regards

Phil H.

Show quoteHide quote
"Ken Slovak - [MVP - Outlook]" <kenslo***@mvps.org> wrote in message
news:#CWX0Xe4EHA.1072@TK2MSFTNGP09.phx.gbl...
> Each Inspector has a CurrentItem property. That is what would have an
> Attachments collection:
>
> Dim oMail As Outlook.MailItem
> Dim colAttach As Outlook.Attachments
>
> Set oMail = oInspector.CurrentItem
> Set colAttach = oMail.Attachments
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>

Bookmark and Share