Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Application.ActiveInspector = Nothing

Posted on 2001-07-13
1
Medium Priority
?
620 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
Neo_mvps earned 800 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
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: …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

721 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