Reply Macro That Inserts Sender's Name

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!
 
S

Sue Mosher [MVP-Outlook]

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
 
M

Michael Hyatt

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
 
S

Sue Mosher [MVP-Outlook]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top