To work with the currently selected item, you'll need to use Explorer code to get the item in the Explorer:
Set objItem = objApp.ActiveExplorer.Selection.Item(1)
When you are looking at an item that is open and has focus, it uses an Outlook Inspector. The code you need to work with Inspectors is:
Set objItem = objApp.ActiveInspector.CurrentItem
When you want to use the macro with both open or selected items, you can use this function to determine if the item is open or selected. You'll call the function in your code in this manner:
Set objItem = GetCurrentItem()
You'll need to put one copy of this function in a module and can use the function in many macros.
Function GetCurrentItem() As Object Dim objApp As Outlook.Application Set objApp = Application On Error Resume Next Select Case TypeName(objApp.ActiveWindow) Case "Explorer" Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1) Case "Inspector" Set GetCurrentItem = objApp.ActiveInspector.CurrentItem End Select Set objApp = Nothing End Function