0

I am having lots of difficulties with the link between MS Access and MS Outlook. Both are at version 2010, I am using the EMailDatabaseObject macro to send a report to a specified email address. It works great, but when I try to run the macro, I get a message stating: "A program is trying to send an e-mail message on your behalf" and asks if I would want to Allow (after 5 seconds of waiting) or Deny.

I've researched into this and realized that it is the Outlook Object Model Guard that is causing this problem. I have configured the Options in both programs, changed the Trust Center for both to Enable all macros, added the Database file location into Access' Trusted Locations, have the "Never warn me about suspicious activity" button checked under Outlook's Programmatic Access, and with all of these set, when I run the macro, it still asks that annoying security warning.

Other solutions show methods of changing the VBA script but I really do not understand or know as to which locations to change what. I've converted my macro to Visual Basic and this is the code:

Option Compare Database

'------------------------------------------------------------
' AutoExec
'
'------------------------------------------------------------
Function AutoExec()
On Error GoTo AutoExec_Err

DoCmd.SendObject acReport, "Campus-Daily-Report", "PDFFormat(*.pdf)", "*To email goes here*", "", "", "Daily Report Test", "Please take a look at the attached.", False, ""


AutoExec_Exit:
Exit Function

AutoExec_Err:
MsgBox Error$
Resume AutoExec_Exit

End Function

I have the macro named AutoExec for the purpose to have the macro run immediately when the file opens.

Please help and let me know what other solutions that I could use for this. If it really requires me to alter the above code, I'm unsure how to change the code for a Macro. I realize that when I converted the macro, it becomes another module that does not work the same way. There are no options in Access to view a Macro's code side.

Any help would be greatly appreciated. I would prefer solutions that would not cost me any $$$, whatever it takes otherwise. Thanks for the help.

4

1 に答える 1

0

SendObject は Simple MAPI を使用しており、セキュリティ プロンプトをバイパスする方法はありません。

最新バージョンのウイルス対策製品がインストールされていることを確認できます (クライアント環境を制御できる場合)。そのため、Outlook オブジェクト モデルとRedemptionを使用してコードを書き直します。http://www.outlookcodeを参照してください。オプションのリストについては、.com/article.aspx?id=52を参照してください。

于 2014-03-03T13:32:28.133 に答える