Macros to send email automatically

P

prague

I was creating a spreadsheet (forms) to collect feedback and I put a
button on called "submit" to get people submit the data...

The code is as follows:

Sub Button1_Click()

MsgBox "Survey Completed. Thanks a lot!"

ActiveWorkbook.Save

Application.Dialogs(xlDialogSendMail).Show

End Sub

In this way I can get the email program open automatically when people
click the button.

But Can I actually modify the code somehow and get my email address
filled and send the email out automatically?

Thanks, P
 
A

Adamaths

Hi,

I have a feeling it depends what e-mail system you are using, but as a
starting point try the following:

ActiveWorkbook.SendMail "Recipients name", "E-Mail subject"

Replace the Recipeints name and E-Mail subject with strings that meet
these criteria.

If thaat doesn't work can you let me know what E-Mail package you are
using - Outlook, Lotus Notes etc.. and I can have another look at it.

Regards,

Adam
 
A

Adamaths

It should work with groupwise - I'm certain I've used the same code
before with Groupwise.

The only thing to be careful of is the way that users names are stored
in groupwise - for example if you put the recipient name as Mike Smith
groupwise may expect to see Smith, Mike.

I would suggest using an external e-mail address even if using
groupwise to send the mail internally.

Regards,

Adam
 
J

Jim May

Thanks Tom;
I'm (still) always afraid that when I try something like this
THE ENTIRE (Office) SYSTEM will go down and
within 2 or 3 minutes I'll be surrounded by several Firemen - and/or the
Hook and Ladder crew -- LOL
Oh well, what the heck,, I'll try it !!
Jim
 
T

Tom Ogilvy

Sendmail is designed to use the default mail application as defined in the
registry. If you can do File=>Send To => Mail Recipient, then it should
work.
 
P

prague

Thanks Adam,

It is working in my Outlook. However I am getting a pop-up saying "some
programs is trying to send email on behalf of you.... " with YES/NO
options while click yes to send out the email with the spreadsheet
attached...

Any ways to modify the text on the pop-up to make it more friendly?

Cheers, P
 
J

Jim May

I gave it a try (at work).
The macro paused along the way (a couple of times
asking for confirmation-type things) but it went-through,
without incident.
Thanks..
 

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