create voting buttons

M

Max Bialystock

Could someone please show me how to modify this script so that the voting
buttons (1, 2, 3) are created programmatically?

(That is without user input.)

Thanks,

Max



------------------------------------------------------------





Sub CreateVoteMessage()

Dim objApp As Outlook.Application

Dim strMsg As String

Dim strActions As String

Dim arrActions() As String

Dim I As Integer

Dim objMessage As Outlook.MailItem

Dim objAction As Outlook.Action

strMsg = "Enter voting button titles, " _

& "separated by commas."

strActions = InputBox(strMsg, "CreateVoteMessage")

If strActions <> "" Then

arrActions = Split(strActions, ",")

Set objApp = CreateObject("Outlook.Application")

Set objMessage = objApp.CreateItem(olMailItem)

With objMessage

.To = "(e-mail address removed)"

End With

For I = 0 To UBound(arrActions)

Set objAction = objMessage.Actions.Add

With objAction

.CopyLike = olRespond

.Enabled = True

.Name = arrActions(I)

.Prefix = ""

.ReplyStyle = olOmitOriginalText

.ResponseStyle = olPrompt

.ShowOn = olMenuAndToolbar

End With

Next I

objMessage.Display

End If



Set objApp = Nothing

Set objMessage = Nothing

Set objAction = Nothing



End Sub
 

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