Buttons or Links Like Voting Buttons In Outlook

H

Heidi

Hi there~ I want to put buttons or links in a word document that work
EXACTLY like the voting buttong in Outlook. When someone clicks on the
button or link, it will automatially send an email to a specified person with
a pre-selected subject. Of course, I realize that I can put the href:mailto
with the email address and subject, but I don't know how to automatically
make it send. Can anyone help?
 
J

Jay Freedman

See http://www.word.mvps.org/FAQs/InterDev/SendMail.htm.

The way I would approach this is to use two MacroButton fields in the
document (http://www.word.mvps.org/FAQs/TblsFldsFms/UsingMacroButton.htm)
that both run the SendDocumentInMail macro from the SendMail article. Add
code to that macro to change the email address and/or the subject line
depending on the code of the MacroButton field that was clicked. When you
receive the emails, you can look at which address they came to or what the
subject line says, to get a count of the votes.

Let's say you have two MacroButton fields that have the following field
codes:

{ Macrobutton vote yes }
{ Macrobutton vote no }

When the fields are updated, the first one will just show yes and the
second one will just show no . (Of course, you can use whatever wording you
want there.) The word 'vote' in the middle is the name of the macro to run.

In the macro named 'vote', use code like this:

Sub vote()
Dim mySubject As String
If Selection.Fields.Count > 0 Then
If InStr(Selection.Fields(1).Code, "yes") Then
mySubject = "Vote YES"
Else
mySubject = "Vote NO"
End If
End If

' assign mySubject to the .Subject of the
' mail message, using the rest of the
' code from the SendMail page
End Sub

This can be extended if you have more than two options for people to choose.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
H

Heidi

Hi Jay. Thanks so much. I'm just learning VBA and I'm pretty good with
Macros in Excel, but I'm still figuring it out in Word. So I set up the
Macro. I inserted the field. But how do I specify what kind of action will
execute the macro. In Excel, I can insert a button, but I don't know how it
is done in Word. OnClick... or whatever. Thanks.
 
H

Heidi

Actually, Jay, I figued it out... you simply click on the field that was
added. So, I got it to work, however, Outlook gives a warning before opening
and before sending. I'm actually mail merging the word doc into an email and
all the people getting the document will be viewing it in Outlook. Is there
a way to simply enable the voting buttons? I don't want that warning to come
up as these people will be freaked out by it. Any help you can provide would
be great!!
 
G

Graham Mayor

You cannot disable warning messages concerning macros in documents, nor can
you force people to allow them to run. They are essential defences against
malicious macro code. It might be simpler to remove the macros and ask the
users to send the form back to your address.

Incidentally you appear to have posted this question in at least three Word
groups. If you must do this, please cross post them so that the questions
and answers are linked, thus avoiding a duplication of effort by those of us
who answer questions.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
H

Heidi

Thanks Graham~ I'm pretty sure I didn't ask to disable the warning messages.
I asked if instead, I could somehow enable the voting buttons in Outlook when
the doc is viewed in Outlook.

Thanks for the message on the three posts... I wasn't sure where it went and
I also wasn't sure how the questions got answered. Of course I really
appreciate the answers and the help and never would presume to make more work
for the people that are so generously and patiently helping the neophyte
users. Consider me duly chastised.
 

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