如何使Access宏绕过Outlook对象模型保护 [英] How to have Access Macro bypass Outlook Object Model Guard

查看:121
本文介绍了如何使Access宏绕过Outlook对象模型保护的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MS Access和MS Outlook之间的链接方面遇到了很多困难。两者都是2010版,我使用EMailDatabaseObject宏将报告发送到指定的电子邮件地址。它工作得很好,但是当我尝试运行宏时,我收到一条消息,指出:程序正在尝试代表您发送电子邮件,并询问我是否要允许(等待5秒后)或拒绝。



我已经研究过这个并意识到导致这个问题的是Outlook对象模型防护。我在两个程序中配置了选项,将信任中心更改为启用所有宏,将数据库文件位置添加到Access'受信任位置,在Outlook的程序访问下选中从不警告我可疑活动按钮,并使用所有这些设置,当我运行宏时,它仍然会询问恼人的安全警告。



其他解决方案显示更改VBA脚本的方法但我真的不明白或知道改变什么位置。我已将我的宏转换为Visual Basic,这是代码:



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





我有一个名为AutoExec的宏,目的是让文件在文件打开时立即运行。



请帮忙,让我知道我可以使用的其他解决方案。如果它真的需要我改变上面的代码,我不确定如何更改宏的代码。我意识到,当我转换宏时,它变成另一个模块不能以相同的方式工作。 Access中没有选项可以查看Macro的代码端。



任何帮助将不胜感激。我更喜欢不会花费任何费用的解决方案,不管它采取什么方式。感谢您的帮助。



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.

推荐答案

恢复 AutoExec_Exit

结束 功能
Resume AutoExec_Exit End Function





I有一个名为AutoExec的宏,目的是让文件在文件打开时立即运行。



请帮助我,让我知道我可以使用的其他解决方案。如果它真的需要我改变上面的代码,我不确定如何更改宏的代码。我意识到,当我转换宏时,它变成另一个模块不能以相同的方式工作。 Access中没有选项可以查看Macro的代码端。



任何帮助将不胜感激。我更喜欢不会花费任何费用的解决方案



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.


这篇关于如何使Access宏绕过Outlook对象模型保护的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆