Get the Selected Inspector

F

Fred Block

Hi All,

I've got a Toolbar working in the Explorer Window just fine (used CBItems
demo and adjusted). However, I need to read data out of a message (Inspector
right?) and can't seem to figure out how to attack the selected *or* opened
message window.

Oh - one more - why can't I copy the example files from the MS Press book
"Building Applications with MS Outlook 2000 Technical Reference" from
Outlook to an explorer window without a message stating that "Outlook
blocked access to this potentially unsafe item."?

All input is greatly appreciated! Thanks in advance!

Kind regards - Fred
 
K

Ken Slovak - [MVP - Outlook]

Application.ActiveInspector is the currently selected Inspector. If
more than 1 is opened you might have to iterate the Inspectors
collection to find the one you want if it's not currently selected.

Randy's book was written long before the current security restrictions
were imposed on Outlook in Outlook 2000 SP2. Any attachment to a
message that is restricted will show that warning. If I recall
correctly there's an installer for the sample apps that will install
everything into PST files that can be used to work with the sample
apps.
 
F

Fred Block

Hi Ken,
Application.ActiveInspector is the currently selected Inspector. If
more than 1 is opened you might have to iterate the Inspectors
collection to find the one you want if it's not currently selected.

Thanks.

Will this hold true even if an Inspector window is not open (i.e., a message
is simply selected from within the Explorer's InBox)?

Kind regards - Fred
 
K

Ken Slovak - [MVP - Outlook]

An Inspector is the window Outlook uses to display items. So if no
item is open there is no Inspector. For selected items in an Explorer
you would use the Selection collection of the ActiveExplorer. That
collection can be iterated to get every selected item.
 
F

Fred Block

Hi Ken,
An Inspector is the window Outlook uses to display items. So if no
item is open there is no Inspector. For selected items in an Explorer
you would use the Selection collection of the ActiveExplorer. That
collection can be iterated to get every selected item.

Cool... So one more then please...

Using the Selection collection of the ActiveExplorer, if I set a reference
to one of the Selection items, can I then get data from this item's
user-defined fields (or does it need to be opened)? The item would be a
message type and I'd have to set something somewhere so I know I'm on the
correct "type" of message (that is, of a form our client has developed).

The bottom line is that I need to build a way for message data to get into
an external database. I was going to add a command button to get the work
done and my thought was to place all of the code in a COM Add-In. The user
opens a message, clicks the toolbar button and the data is read/written.

Thanks for all of your time Ken - much appreciated!

Kind regards & Happy Holidays!
- Fred
 
K

Ken Slovak - [MVP - Outlook]

Dim oMail As Outlook.MailItem

On Error Resume Next

Set oMail = Application.ActiveExplorer.Selection(1)
If Err Then
'not mail item
Else
'get whatever properties you want from oMail
End If
 
F

Fred Block

Thanks Ken!
Dim oMail As Outlook.MailItem

So have you written a book perhaps I should buy?

Have a great holiday! Off to trying to code this thing now and get it going!

Kind regards - Fred
 
K

Ken Slovak - [MVP - Outlook]

My programming books are now out of print, although the Outlook 2000
one for Wrox is an ebook at an exorbitant price. I'm considering
offers from 2 publishers for writing an Outlook 2003 programming book.
 
F

Fred Block

Hi Ken
I'm considering
offers from 2 publishers for writing an Outlook 2003 programming book.

Well best of luck - I'll look for it! Post the news in the group if it hits
the shelves!

Kind regards - Fred
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top