1
votes

I send an email using Outlook 2010 with Access VBA.

I get a warning from Microsoft Outlook about a program trying to send an email and I'm forced to push allow.

I have the Microsoft Outlook Object Library 14 from the reference in VBA.

In Outlook - Options - access through programin is marked on don't show warnings.

I added the next entries in regedit

Key: HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\ 
<version>\Outlook\Security
Value name: AdminSecurityMode
Value type: REG_DWORD
Value: 3

Key: HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\ 
<version>\Outlook\Security
Value name: PromptOOMSend
Value name: PromptOOMAddressBookAccess
Value name: PromptOOMAddressInformationAccess
Value name: PromptOOMMeetingTaskRequestResponse
Value name: PromptOOMSaveAs
Value name: PromptOOMFormulaAccess
Value name: PromptSimpleMAPISend
Value name: PromptSimpleMAPINameResolve
Value name: PromptSimpleMAPIOpenMessage
Value type: REG_DWORD
Value: 2

I also add DoCmd.SetWarnings False in the email function.

How to disable this warning?

3

3 Answers

2
votes

The common way to solve this is to install and use Outlook Redemption .

Another method is to bypass Outlook completely and send via SMTP, but that is another story and requires a lot more code.

1
votes

You get a standard security prompt in Outlook.

There are several ways for supressing such prompts:

  1. Use a third-party components for supressing Outlook security warnings. See Security Manager for Microsoft Outlook for more information.

  2. Use a low-level API instead of OOM. Or any other third-party wrappers around that API, for example, Redemption.

  3. Develop a COM add-in which has access to the trusted Application object.

  4. Use group policy objects for setting up machines.

0
votes

The warning appears for using DoCmd.sendObject to send an email, so instead of downloading thir party components.

I just not used doCmd.sendObjects and used a function like this:

 Public Function CreateNewMessage()
 Dim objMsg As MailItem

 Set objMsg = Application.CreateItem(olMailItem)

 With objMsg
.To = "[email protected]"
.CC= "[email protected]"
.BCC = "[email protected]"
.Subject = "This is the subject"
.Categories = "Test"
.VotingOptions = "Yes;No;Maybe;"
.BodyFormat = olFormatPlain ' send plain text message
.Importance = olImportanceHigh
.Sensitivity = olConfidential
.Attachments.Add ("path-to-file.docx")

' Calculate a date using DateAdd or enter an explicit date
.ExpiryTime = DateAdd("m", 6, Now) '6 months from now
.DeferredDeliveryTime = #8/1/2012 6:00:00 PM#

.Display
End With

Set objMsg = Nothing
End Function

Thank you so much