Macro to add voting buttons

G

Guest

Help! I am completely new to VBA. I want to write a macro to add a unique set of voting buttons to existing mail items that can then be forwarded. I don't want to have to type in the same choices each time I need them.
 
S

Sue Mosher [MVP-Outlook]

Take a look at the MailItem.Actions collection. Each Action represents a
voting button. The object browser and Help will introduce you to the
properties, but the best way to learn them is to experiment.

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



Natalie said:
Help! I am completely new to VBA. I want to write a macro to add a
unique set of voting buttons to existing mail items that can then be
forwarded. I don't want to have to type in the same choices each time I
need them.
 
S

Sue Mosher [MVP-Outlook]

Why don' t you show what you've done already and explain how you want to
modify it?

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



Natalie said:
I know that each voting button is an action and I think I know all the
settings I need for each, I'm having trouble adding them to the existing
mail item. I'm working with listing 10.3 from your book and trying to
modify it. I am not a programmer at all and having lots of trouble.
 
G

Guest

Well, I'm a little further than my last post. I have the macro built to create a new e-mail message and add the six voting buttons that I want. I just can't figure out how to get it to add the voting buttons to a mail message I already have open. Here's my macro. Thanks for your patience.

Sub AddChgApprVoteButtons()
Set objApp = CreateObject("Outlook.Application")
Set objMessage = objApp.CreateItem(olMailItem)
Set objAction = objMessage.Actions.Add
With objAction
.CopyLike = olRespond
.Enabled = True
.Prefix = ""
.ReplyStyle = olIndentOriginalText
.ResponseStyle = olPrompt
.ShowOn = olMenuAndToolbar
.Name = "Approved, user tested & validated"
End With
Set objAction = objMessage.Actions.Add
With objAction
.CopyLike = olRespond
.Enabled = True
.Prefix = ""
.ReplyStyle = olIndentOriginalText
.ResponseStyle = olPrompt
.ShowOn = olMenuAndToolbar
.Name = "Approved, systems tested & user validated"
End With
Set objAction = objMessage.Actions.Add
With objAction
.CopyLike = olRespond
.Enabled = True
.Prefix = ""
.ReplyStyle = olIndentOriginalText
.ResponseStyle = olPrompt
.ShowOn = olMenuAndToolbar
.Name = "Approved, systems tested & validated"
End With
Set objAction = objMessage.Actions.Add
With objAction
.CopyLike = olRespond
.Enabled = True
.Prefix = ""
.ReplyStyle = olIndentOriginalText
.ResponseStyle = olPrompt
.ShowOn = olMenuAndToolbar
.Name = "Approved, untested & no validation"
End With
Set objAction = objMessage.Actions.Add
With objAction
.CopyLike = olRespond
.Enabled = True
.Prefix = ""
.ReplyStyle = olIndentOriginalText
.ResponseStyle = olPrompt
.ShowOn = olMenuAndToolbar
.Name = "Requires follow-up before approval"
End With
Set objAction = objMessage.Actions.Add
With objAction
.CopyLike = olRespond
.Enabled = True
.Prefix = ""
.ReplyStyle = olIndentOriginalText
.ResponseStyle = olPrompt
.ShowOn = olMenuAndToolbar
.Name = "Declined"
End With
objMessage.Display
End Sub
 
S

Sue Mosher [MVP-Outlook]

Great progress! The mail message that you have open is
Application.ActiveInspector.CurrentItem or, in your case,
objApp.ActiveInspector.CurrentItem

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



Natalie said:
Well, I'm a little further than my last post. I have the macro built to
create a new e-mail message and add the six voting buttons that I want. I
just can't figure out how to get it to add the voting buttons to a mail
message I already have open. Here's my macro. Thanks for your patience.
 
G

Guest

Thank you! It worked exactly how I wanted it. I have been working on this for quite some time. I'm so glad I decided to try the discussion group today. Thanks again!!!
 
S

Sue Mosher [MVP-Outlook]

Nice way to end the week, eh? Glad it worked for you.

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



Natalie said:
Thank you! It worked exactly how I wanted it. I have been working on
this for quite some time. I'm so glad I decided to try the discussion group
today. Thanks again!!!
 

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