Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Application.ActiveInspector = Nothing

Posted on 2001-07-13
1
Medium Priority
?
627 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 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Take a look at these 6 Outlook Email management tools which can augment the working and performance of Microsoft Outlook to give you a more rewarding emailing experience.
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
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: …

916 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