Macro Security

  • Thread starter blackbox via OfficeKB.com
  • Start date
B

blackbox via OfficeKB.com

I have a macros in excel that generate emails in Outlook. As it is now, I
press a command button which generates the email and I then have to press
Send on each.

When I change the macro from .Display to .Send, Outlook's security catches it
and after several seconds displays a message box staiting that "A program is
attempting to send an email on your behalf. Do you want to continue?"

It kind of defeats the purpose of the .Send command, especially since it's
slower than displaying the email and hitting the send button.

I don't want to shut off the macro security completely.

Is there a way to authorize specific macro to run without the security pop-up?
 
M

Michael Bauer [MVP - Outlook]

Please read:
http://www.outlookcode.com/d/sec.htm

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Mon, 11 Jun 2007 04:02:24 GMT schrieb blackbox via OfficeKB.com:
I have a macros in excel that generate emails in Outlook. As it is now, I
press a command button which generates the email and I then have to press
Send on each.

When I change the macro from .Display to .Send, Outlook's security catches it
and after several seconds displays a message box staiting that "A program is
attempting to send an email on your behalf. Do you want to continue?"

It kind of defeats the purpose of the .Send command, especially since it's
slower than displaying the email and hitting the send button.

I don't want to shut off the macro security completely.

Is there a way to authorize specific macro to run without the security
pop-up?
 
B

blackbox via OfficeKB.com

just a follow up for anyone interested. i bypassed Outlook all together.
Found a nice little piece of CDO code that works perfectly.
Only 1 draw back I've found. tried to use a range of cells for the body of
the email. it will accept 1 cell but not multiple. but the body of my email
is always the same, so I added it into the code

Sub Send_Email()
Dim cdoConfig
Dim msgOne

Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mail.terranovatrading.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpUserName")
= "myName"
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpPassword")
= "myPassword"
.Update
End With

Set msgOne = CreateObject("CDO.Message")
Set msgOne.Configuration = cdoConfig
msgOne.To = "(e-mail address removed)"
msgOne.From = "(e-mail address removed)"
msgOne.Subject = "Test"
msgOne.TextBody = "Message line 1" _
& vbcr & "Message line 2"
msgOne.Send

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