Solved

Application.ActiveInspector = Nothing

Posted on 2001-07-13
1
597 Views
Last Modified: 2008-02-26
In Outlook, I want to work with the Item that has been selected by single clicking on it.  The code below, does only work if an item has been opened.  If an item has only been selected by single click, the code below, will set olInspector to Nothing.  How do I get the item that are selected??

Dim olInspector As Outlook.Inspector
Dim olItem As Outlook.MailItem
 
 
Set olInspector = Application.ActiveInspector
If Not (olInspector Is Nothing) Then
    Set olItem = olInspector.CurrentItem


brgds
Nicolas
0
Comment
Question by:nicolas_image
1 Comment
 
LVL 16

Accepted Solution

by:
Neo_mvps earned 200 total points
ID: 6280674
Assuming Outlook 2000/2002 ~ you will want to use the Selection method exposed by the Explorer object.

Dim oSelection As Outlook.Selection
Dim oExplorer As Outlook.Explorer
Dim oObject As Object

Set oExplorer = Application.ActiveExplorer
If Not(oExplorer Is Nothing) Then
  Set oSelection = oExplorer.Selection
  If oSelection.Count >= 1 Then
    Set oObject = oSelection.Item(1)
    If oObject.Class = olMail Then
      ' You can reassign to a mail item here
      ' or work with item directly
    End If
  End If
End If

Set oObject = Nothing
Set oSelection = Nothing
Set oExplorer = Nothing
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now