Submit Word Form via Email in VBA Macro

N

NYSA-HD

I have a survey form in MS Word using Word Fields. I would like to create a
submit button that emails the form (regardless of email client-must be able
to work w/ other email apps like Thunderbird, etc...) to a designated address
(ie: (e-mail address removed).

The code I was attempting was (shown below) - but every time I run it I get
general mail failure. Any ideas?

Thanks in advance.
-----------------------
Activedocument.HasRoutingSlip = True
With Activedocument.RoutingSlip
.Subject = "New subject goes here"
.AddRecipient "(e-mail address removed)"
.AddRecipient "(e-mail address removed)"
.Delivery = wdAllAtOnce
End With
Activedocument.Route
 
M

Mad Dad

NYSA-HD said:
I have a survey form in MS Word using Word Fields. I would like to create
a
submit button that emails the form (regardless of email client-must be
able
to work w/ other email apps like Thunderbird, etc...) to a designated
address
(ie: (e-mail address removed).

The code I was attempting was (shown below) - but every time I run it I
get
general mail failure. Any ideas?

Thanks in advance.
-----------------------
Activedocument.HasRoutingSlip = True
With Activedocument.RoutingSlip
.Subject = "New subject goes here"
.AddRecipient "(e-mail address removed)"
.AddRecipient "(e-mail address removed)"
.Delivery = wdAllAtOnce
End With
Activedocument.Route

I too have been looking and exhausted Google in my efforts. I am not a
coder and many suggestions I found impled that I need to be, thus very
little real assistance available to me.... While I can use Adobe Pro to do
what I want, not all of us have Adobe Pro, but every one has access to Word.
NOTE: We do not use outlook as a mail system.

1: My errors were in the first line to start with..
Activedocument.HasRoutingSlip = True

Thus, I found that I had to enable routing... That in it's self is not
straight forward and is dependant which version of word, one is using. As to
what options you are presented with when selecting the sent to.

We use a mix of Office 2003 and 2002 at work...

2: However can not find the Send to for Review / Routing in Office 2007?

I liked forms... Simple and did most of what we needed... but it was always
a pain to get people to return them... Now all I want is a Submit button :)
or the code that I can copy and paste; That allows a document that has been
edited or had forms fiels filled in, to be "Ättached to an e-mail" and
returned to an address of my chosing.

At this stage, I am still looking but find it hard to believe that an
application of this level is now to the extent that the average user is now
lost, with out a coding background or having their own web server to do any
thing.

If any one can assist you have my sincere thanks.

Mark
 
D

Doug Robbins - Word MVP

If you want to automate something, then you have to expect to use some code
to do it.

See the article "How to send an email from Word using VBA" at:

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

and "What do I do with macros sent to me by other newsgroup readers to help
me out?" at:

http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm




--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
M

Mad Dad

Doug

Have aready found the link to the SendMail from word using the built-in
RoutingSlip method.

Problem is as stated in my post, that getting the document activated for a
RoutingSlip is the issue.

It is a bit of a hit and miss depending on which version and there is
little I could find on this.

As I understand it... Please feel free to correct any of my steps if in
error....

1: Some how activate RoutingSlip (Version dependent) -

A: Step one is to open the document > use the send to Routing (Office 2002)
then when the document is in the email, stop and drag it to your working
folder?

B: Office 2003 ???

B: Office 2007 ???

2: Add a button, at the bottem of the page of the document that you want to
send out and have returned; then apply this code( as per the other link you
provided):

Activedocument.HasRoutingSlip = True
With Activedocument.RoutingSlip
.Subject = "New subject goes here"
.AddRecipient "(e-mail address removed)"
.AddRecipient "(e-mail address removed)"
.Delivery = wdAllAtOnce
End With
Activedocument.Route

Save this doc as your final.

3: Then attach and send out to those you want, and when they finish
entering the data, they hit the submit and it returns the filled in document
to the addresses identified in the code attached to you submit button.

Please feel free to correct any of my steps if in error....

Mark
 
N

NYSA-HD

The code in the site does not function as well as all the facts that you have
stated. We ended up just creating the Word form, but having people put the
to in manually. The adobe was an issue because it didn't want to work with
certain email applications.
 
D

Doug Robbins - Word MVP

The .HasRoutingSlip, .Route, .Routed and .RoutingSlip methods/attributes are
not available in VBA with Word 2007.

There is a Send for Review button that you can add to the QAT though that
might suit your purpose.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
B

BZ

I believe I just did what you are wanting to do, using the Review method....
I created a command button on my form and used the following code:

ActiveDocument.SendForReview _
Recipients:="Your Email address here", _
Subject:="Your Subject here", _
ShowMessage:=False, _
IncludeAttachment:=True
MsgBox "Your Message has been sent!"

Hope that's what you were looking for!
 

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