Solved

Application.ActiveInspector = Nothing

Posted on 2001-07-13
1
599 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Resolve DNS query failed errors for Exchange
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

932 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

15 Experts available now in Live!

Get 1:1 Help Now