Solved

Outlook 2010: Need macro to add voting buttons to current message

Posted on 2015-01-06
6
280 Views
Last Modified: 2015-01-13
I need a macro to automatically add voting buttons to the active message draft.

This is for our word processing department.  When they return a job by replying to the original message, I want them to be able to run a macro that will add voting buttons labeled 1 through 10, so the recipient can quickly rate the quality of the job.

I can find macros that create a new message with voting buttons, but I want to simply add them to the currently drafted message.  I am familiar with Word VBA, but not as familiar with Outlook VBA.
0
Comment
Question by:Dave Kong
  • 4
  • 2
6 Comments
 
LVL 2

Expert Comment

by:Pratik Makwana
Comment Utility
Please Refer this site : HELP
0
 

Author Comment

by:Dave Kong
Comment Utility
Pratik:

Thank you for the link.  I already know how to simply create custom voting buttons in a message.  What I need is a macro that can set it up automatically.  It is unrealistic that my processors can take the time to manually set up 10 different buttons.  A macro would make it super easy for them, and therefore more likely that they will include it in responses.

Dave
0
 
LVL 2

Expert Comment

by:Pratik Makwana
Comment Utility
Use Msg.VotingOptions = "Yes;No;Maybe So" in below code.....
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Sub TestMacro()
Dim Email As String, Subj As String
Dim Msg As String, URL As String
Dim r As Integer, x As Double
For r = 2 To 3 'data in rows 2-3
' Get the email address
Email = Cells(r, 2)

' Message subject
Subj = Cells(r, 4)
' Compose the message
Msg = ""
Msg = Msg & "Dear " & Cells(r, 1) & "," & vbCrLf & vbCrLf
Msg = Msg & "This is regarding a PeS query "
Msg = Msg & Cells(r, 3).Text & "." & vbCrLf & vbCrLf
Msg = Msg & "Please let us know if you are using this query or can it be archived" & "." & vbCrLf & vbCrLf
Msg = Msg & "Velmurugan" & "," & vbCrLf
Msg = Msg & "HR Ops Analyst," & vbCrLf
Msg = Msg & "Global Reporting Operations Team."

' Replace spaces with %20 (hex)
Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")
Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")

' Replace carriage returns with %0D%0A (hex)
Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A") ' Create the URL
URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg
' Execute the URL (start the email client)
ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus
' Wait two seconds before sending keystrokes
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%s"
Next r
End Sub

Open in new window

0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:Dave Kong
Comment Utility
Pratik:

Thanks for posting this.  However, I am looking over the code and not seeing any line that involves voting buttons.  Am I missing it?

Dave
0
 

Accepted Solution

by:
Dave Kong earned 0 total points
Comment Utility
Pratik:

I am short on time to complete this project and not finding any quick answers.  As an alternative, I have decided to create a custom message form that will have the voting buttons I need built in.  That is not quite as elegant or as versatile, but it will work.  Thanks for your help.

Dave
0
 

Author Closing Comment

by:Dave Kong
Comment Utility
I am only accepting this solution because I have limited time before I have to present a draft.  Using a custom form is nowhere near as cool as the macro would have been, and I see from various posts evidence that it COULD be done.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In case Office 2010 has not been deployed in your environment, this article may be quite useful. In our office, we wanted a way to deploy Microsoft Office Professional Plus 2010 through an automated batch file via logon script. This article is docum…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now