PDA

View Full Version : Disabling Outlook alert



clvestin
01-26-2006, 02:23 PM
I'm sending an excel sheet attached to an email through Outlook


ActiveWorkbook.SendMail Recipients:=names


I recieve an alert notifying me that an application is attempting to send an automated email. It must be confirmed before the email is sent. Any way to not get this alert??

matthewspatrick
01-26-2006, 03:58 PM
This is actually a safety enhancement to try and prevent malicious code from propagating itself through your email.

If you want to be able to use the SendMail method, which can be handy, then I recommend using ClickYes:
http://www.contextmagic.com/express-clickyes/

Other alternatives include using the CDO library, or using the Redemption library:
http://www.dimastr.com/redemption/

Patrick

Shazam
01-26-2006, 04:12 PM
You can use a send key method. Take this example below.



Sub Send_Test()
Dim objol As New Outlook.Application
Dim objmail As MailItem
Set objol = New Outlook.Application
Set objmail = objol.CreateItem(olMailItem)
With objmail
.To = "Anybody@home.com"
.Subject = "Who/Me"
.Body = ""
.NoAging = True
.Attachments.Add "C:\A test.xls"
.Display
End With
Set objmail = Nothing
Set objol = Nothing
SendKeys "%{s}", True

End Sub

matthewspatrick
01-26-2006, 04:19 PM
You can use a send key method.

But that would still trigger the security alert. The alert pops up whenever another app tries to touch the Outlook object model.

Patrick

Zack Barresse
01-26-2006, 04:28 PM
Hi,

To just send an email without any user interaction, you need Outlook Redemption. Google it on the web. For help, check out www.slipstick.com or Sue Mosher's site www.outlookcode.com.

I prefer to send email using late binding personally. Check out kpuls site on late binding here: http://www.excelguru.ca/XLVBA/XLVBA08.htm, or post back if you need an example.

Shazam
01-26-2006, 04:29 PM
Send key method is a key stroke. It should by pass the security alert. I've tested it and it does by pass it.

Zack Barresse
01-26-2006, 04:30 PM
I would not recommend using SendKeys whatsoever. It's too volatile of an action.

Shazam
01-26-2006, 04:39 PM
I never had a problem using it. what are the potential problems might occur?

Zack Barresse
01-26-2006, 04:42 PM
Timing, slow apps, stepping through, debugging, the list goes on. If you can stray away from it, I would.