Solved

Application.ActiveInspector = Nothing

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

636 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