VBA to Email Attachment

J

Jim Palmer

I have a macro that emails monthly reports to several department heads.

Does anyone know if there is a way to prevent the message "A program i
tyring to automatically send email on your behalf ... if this i
unexpected it could be a virus" ?

I have to press "yes" each time, and the macro sends reports to man
addresses.

I understand the need for this security, however I would think there i
some way to advise the computer "it's okay, it's me".

Any assistance would be appreciated.

The code I use follows:

Sub SendReports()


Dim ol As Object, myItem As Object
Set ol = CreateObject("outlook.application")


MyText = Range("Email_Comment").Value



Set myItem = ol.CreateItem(olMailItem)
myItem.To = "email address"
myItem.Subject = "Subject Line"
myItem.Body = MyText
myItem.Body = myItem.Body & "" & Chr(13) & Chr(13)

Set myAttachments = myItem.Attachments
myAttachments.Add "Path name of file to attach"
myItem.Send


' Other addresses and attachments are entered here

Set ol = Nothing


End Su
 
P

Paul B

Jim, I think this would be set in outlook and not excel, I don't use
outlook, but in outlook express there is a option under tools options
security, that has warn me when other applications try to send mail, if you
uncheck it you will not get the message, maybe outlook has something like
this

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
 

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