Create a Macro in Outlook

B

Bert

Hello. I am having a challenging time creating a macro in Outlook. I'm
trying to create a macro when replying to an email, in the Subject line will
automatically populate #ms#. Which MS is how our Mail Secure of how
confidential data flows through.
 
S

Sue Mosher [MVP-Outlook]

Where are you encountering problems? Exactly how do you want the Subject line to look -- does #ms# replace, precede, or follow the standard RE: prefix?
 
B

Bert

I'm having problems with the Outllok Codes, since Outlooks does not record
macros. The #ms# would follow the standard RE: prefix.
 
S

Sue Mosher [MVP-Outlook]

Though no macro recorder is available (and the same is true for most Office programs), there is a huge amount of Outlook sample code available, included that in the Help system itself. Where in particular are you stumped?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
B

Bert

I am new to this I am stumped at the following:

Sub ms()
ReplyMail.Subject = "#ms#"(remainder of the subject)
End Sub

Thanks for your assistance.
 
S

Sue Mosher [MVP-Outlook]

Just as the + operator is used to add two numbers together, the & operator is
used to join two strings together:

ReplyMail.Subject = "#ms#" & ReplyMail.Subject

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
B

Bert

Hi Sue,

I am getting a Run-time error 424.

Sub ms()
ReplyMail.Subject = "#ms#"
End Sub

Is this how I should have macro. Thanks for your help.

Bert
 
S

Sue Mosher [MVP-Outlook]

Do you have other code that declares the ReplyMail object at the module level
and instantiates it? If not, Outlook has no way of knowing what ReplyMail
refers to (and neither do we, because we don't know whether you want a macro
that replies to a current message or whether you want a macro that acts on
the currently display message).
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
B

Bert

No I do not have another code. A macro that replies to a current message and
adding the #ms# to the reply.
 
B

Bert

I GOT IT SUE. And it works as follows:

Sub ms()
Set objItem = Application.ActiveInspector.CurrentItem
objItem.Subject = "#ms# " & objItem.Subject
End Sub

Thank you for being patient with me.
 
S

Sue Mosher [MVP-Outlook]

Great! And now you have a whole new set of skills that you can apply to your
next Outlook productivity task.
--
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