' Outlook VBA Script that gets EntryID and StoreID of the Currently Selected Email
' Use Tools->Macro->Security to allow Macros to run, then restart Outlook
' Run Outlook, Press Alt+F11 to open VBA
' Programming by Greg Thatcher, http://www.GregThatcher.com
Option Explicit
Public Sub GetEntryIDAndStoreIDOfCurrentEmail()
Dim Session As Outlook.NameSpace
Dim currentExplorer As Explorer
Dim Selection As Selection
Dim currentItem As Object
Dim currentMail As MailItem
Dim entryID As String
Set currentExplorer = Application.ActiveExplorer
Set Selection = currentExplorer.Selection
'for all items do...
For Each currentItem In Selection
If currentItem.Class = olMail Then
Set currentMail = currentItem
MsgBox "EntryID is " & currentMail.entryID & vbCrLf & vbCrLf & " Store ID is " & currentMail.Parent.StoreID
End If
Next
End Sub
|
|