Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook automation security

Status
Not open for further replies.

stkarma

Technical User
Oct 3, 2001
31
US
Outlook dialog box prompts after following VBA code:

With outMessage
.To = email
.Subject = jobNO & " New Customer Service Issue"
.body = "New Customer Service Issue, # " & jobNO & " " & JObname & " issue: " & csIssue
.send
End With

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

What VBA code can I add so this dialog box does not appear?

Thanks
 
I have the same problem and cannot find a solution...

 
I've never encountered an error message like that when trying to send emails from Access. Try adding this before your code: Docmd.SetWarnings False

Here is the code I use,

[tt]Sub SendMailWithOutlook()

'<< Add the Microsoft Outlook 9.0 Object Library to your VB references >>
'<< The number may not be different depending on your operating system >>

'<< Make sure Outlook is open before you run this routine >>
Set objOutlook = CreateObject(&quot;Outlook.application&quot;)
Set objMail = objOutlook.CreateItem(0)

'<< Remove the text qualifiers to enable other sections of the mail >>

'Let objMail.Subject = &quot;&quot;
Let objMail.Subject = &quot;TEST1&quot;
'Let objMail.SentOnBehalfOfName = &quot;&quot;
Let objMail.To = &quot;Enter email address's here&quot;
'Let objMail.cc = &quot;&quot;
'Let objMail.bcc = &quot;&quot;
'Let objMail.HTMLBody = &quot;&quot;
'Let objMail.Body = &quot;&quot;


'<< add attachments >>
Set objAttachment = objMail.Attachments
'objAttachment.Add LocationOfTheFile, , ,

'<< Previews the email >>
'objMail.display

'<< Saves the email as a draft >>
'objMail.save

'<< Sends the email >>
objMail.send

'objOutlook.Quit

End Sub[/tt]


Dan

 
Actually, this is a &quot;Feature&quot; of the new versions of access. It's to prevent rogue code from sending e-mail to everyone in your address book, etc.

To tackle it, check out an _excellent_ program called redemption ( Pretty slick stuff.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top