Email and Excel Problem

C

carl

I've been using this code and it has been working great:

'Sub Mail_ActiveSheet_Body()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "abc.com"
.CC = "efg.com"
.BCC = ""
.Subject = Sheets("trading").Range("A9").Value
.HTMLBody = SheetToHTML(ActiveSheet)
.Send 'or use .Display

Now when I run the macro, I get an Outlook message that

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

The window gives me choices Yes, No, Help.

If I say yes. the email goes out. If I say no, the vba gets stuck on the
last line of the code above.

Is there any way to stop this outlook message - speed is very important in
my application and this Outlook message really slows things down.

Thank you in advance.
 

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