E-mail Code

Z

Zan

Hi,

I have a button that automatically sends an e-mail to
managers of the current worksheet. I have to make a slight
change to the sheet for each manager before I send it out.

When I click the button I get the message that Excel is
trying to automatically send an E-mail, and it may contain
a virus..do you want to send the mail..a progress bar
completes and a Yes No option appears..I click yes and the
e-mail sends.

I use Office XP, this didn't happen in Excel 97, is there
a way to get rid of that box?


Thanks
 
J

Jeff Standen

Pain in the backside isn't it? There are ways around it, some more
complicated than others. The simplest way I've seen is this one:

http://www.rondebruin.nl/cdo.htm

There is also a replacement for the Outlook object model called Redemption.
There are also other ways - Google's the place to look I reckon.

Jeff
 
D

dude

I am an XP user & do a simlar thing in Excel to you.
Line of code I use is: ActiveWorkbook.SendMail Recipients:=
to date, this has thrown up any warning boxes!
If this does not work you can try following:

Sub SendEmail()
Dim olapp As Object
Dim olmail As Object
Set olapp = CreateObject("outlook.application")
Set olmail = olapp.createitem(0)
With olmail
.Subject = "Test" 'enter subject here
.Recipients.Add "[email protected]" 'add email
address here
.body = "This is a Test" 'enter message here
.attachments.Add 'reference any attachement
.send
End With
Set olmail = Nothing
Set olapp = Nothing
End Sub

Hope helpful
 
Top