Reply Macro That Inserts Sender's Name

  • Thread starter Thread starter Michael Hyatt
  • Start date Start date
M

Michael Hyatt

I want to create a macro that replicates the Reply command. The macro
inserts the first name of the original sender (the person to whom the user
is replying) in the body of the e-mail. This will need to be done with the
Redemption library so as to avoid the Outlook 2003 security alerts. Before I
go to a lot of trouble trying to write this (Redemption is still new to me),
I thought I'd ask to see if someone could share a code snippet. Thanks!
 
If you're using Outlook 2003, you don't need Redemption. Macros are trusted,
as long as all your objects derive from the intrinsic Application object:

Set objNS = Application.GetNamespace("MAPI")
strName = objNS.CurrentUser
 
Sometime, I don't even know what I don't know! Thanks, Sue

For anyone following this thread, here's the full code I used:

Sub GetSenderName()
Dim myNamespace As Outlook.NameSpace
Dim objItem As Object

Set myNamespace = Application.GetNamespace("MAPI")
Set objItem = myNamespace.Application.ActiveExplorer.Selection.Item(1)

MsgBox objItem.SenderName

Set myNamespace = Nothing
Set objItem = Nothing

End Sub
 
Still too complicated. You don't need a Namespace object. Just use:


Set objItem = Application.ActiveExplorer.Selection.Item(1)
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top