Setting to suppress warning message

J

Jason Morin

Hello, using Outlook 2003. I use some basic VBA code (see
below) in Microsoft Excel that sends an email with an
attachment. However, each time I run the macro from
Excel, Outlook gives me the message:

"A program is trying to automatically send an e-mail on
your behalf. Do you want to allow this?"

Rather than pressing "yes" each time, is there any way to
suppress this message in Outlook and let the email fly?

Thanks.
Jason

////////////////////////////////
Sub Mail_File()
'Ron de Bruin
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "[email protected]"
.CC = ""
.BCC = ""
.Subject = "IE Favorites"
.Body = ""
.Attachments.Add ("S:\blahblah")
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
 

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