Code: Select all
^a::
MsgBox % "The display name is " . ComObjActive("Outlook.Application").ActiveWindow.Caption . "."
Return
Code: Select all
win := ComObjActive("Outlook.Application").ActiveWindow
MsgBox % TypeName(win)
Code: Select all
^a::
MsgBox % "The display name is " . ComObjActive("Outlook.Application").ActiveWindow.Caption . "."
Return
Code: Select all
win := ComObjActive("Outlook.Application").ActiveWindow
MsgBox % TypeName(win)
Code: Select all
; http://answers.microsoft.com/en-us/office/forum/office_2007-customize/need-vba-to-obtain-smtp-address-of-exchange-user/97833c7c-18e3-4b8d-923a-606b81c9ecd1?auth=1
olApp := ComObjActive("Outlook.Application")
olNamespace := olApp.GetNamespace("MAPI")
Window := olApp.ActiveWindow
if (Window.Class = 35) ; 35 = An Inspector object. (The email is open in its own window)
{
SmtpAddress := ""
MailItem := Window.CurrentItem
FromName := MailItem.SenderName
Recip := olApp.Session.CreateRecipient(FromName)
Recip.Resolve
if (Recip.Resolved)
{
UserType := Recip.AddressEntry.AddressEntryUserType
if (UserType = 0 || UserType = 10) ; olExchangeUserAddressEntry || olOutlookContactAddressEntry
SmtpAddress := Recip.AddressEntry.GetExchangeUser.PrimarySmtpAddress
else if (UserType = 1) ; olExchangeDistributionListAddressEntry
SmtpAddress := Recip.AddressEntry.GetExchangeDistributionList.PrimarySmtpAddress
}
if (SmtpAddress = "")
SmtpAddress := MailItem.SenderEmailAddress
}
MsgBox, % "SmtpAddress: " SmtpAddress
return
Code: Select all
Recip := olApp.Session.CreateRecipient(FromName)