vba 如何消除ms-access项目启动时的安全警告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/226291/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 09:26:26  来源:igfitidea点击:

How to eliminate the security warning at the startup of a ms-access project

vbams-accessaccess-vbams-office

提问by Varun Mahajan

While opening any MS Access database, a security warning appears saying that the file can be harmful to the computer. However, is there a way to remove this message. Or should it remain a necessary evil

打开任何 MS Access 数据库时,都会出现一条安全警告,指出该文件可能对计算机有害。但是,有没有办法删除此消息。或者它应该仍然是一种必要的邪恶

回答by Bryan

You can probably sign your program. I don't know for sure. Read this articleand see if the same principle applies.

您可能可以签署您的程序。我不确定。阅读这篇文章,看看是否同样适用。

回答by Fionnuala

Here are some more notes on certification and security.

以下是有关认证和安全性的更多说明。

Certification, including self-certification: http://office.microsoft.com/en-us/access/HP010397921033.aspx

认证,包括自我认证:http: //office.microsoft.com/en-us/access/HP010397921033.aspx

General information on security principals for Office code and macro security: http://office.microsoft.com/en-us/ork2003/CH011480831033.aspx

Office 代码和宏安全的安全主体的一般信息:http: //office.microsoft.com/en-us/ork2003/CH011480831033.aspx

Trusted location defaults for Office 2003 http://office.microsoft.com/en-us/ork2003/HA011403181033.aspx?pid=CH011480851033

Office 2003 的受信任位置默认值 http://office.microsoft.com/en-us/ork2003/HA011403181033.aspx?pid=CH011480851033

Macro security in Office 2003 http://office.microsoft.com/en-us/ork2003/HA011403071033.aspx?pid=CH011480831033

Office 2003 中的宏安全性 http://office.microsoft.com/en-us/ork2003/HA011403071033.aspx?pid=CH011480831033

回答by EBGreen

If you lower the security settings in your Access options it will go away I believe. Of course those settings are set where they are for a reason.

如果您降低访问选项中的安全设置,我相信它会消失。当然,这些设置是有原因的。

回答by ideaztech

You can eliminate the security warning at the startup of a ms-access project by putting the access project in a Trusted Location. Or Better yet, make your own Trusted Location.

您可以通过将访问项目放在Trusted Location 中来消除 ms-access 项目启动时的安全警告。或者更好的是,创建自己的可信位置。

I recommend creating a folder in the System (C) drive with the name of your project. For example, we could call the folder Database (Path: C:\Database)

我建议使用您的项目名称在系统 (C) 驱动器中创建一个文件夹。例如,我们可以调用文件夹数据库(路径:C:\Database)

Then enter this path as a registry key like this:

然后将此路径作为注册表项输入,如下所示:

[HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security\Trusted Locations\Location20] "Path"="C:\Database" "Description"="Access Project location"

[HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security\Trusted Locations\Location20] "Path"="C:\Database" "Description"="访问项目位置"

Now lets explain a few things about what this key did:

现在让我们解释一下这个键的作用:

  • The number "14.0"is the version of MS Office. You can simply change that to the number that represents the version you are running.
  • The "Location20"is a unique name that we assigned. The 20 can be any number that is not already used. Other programs, including default MS Access wizards, already may have used other numbers. Or if you want to make more then one path as a trusted location, then each location must end with a different number.
  • The "C:\Database\"actually is the physical path that you want to set to be a Trusted Location. You can put any path that you choose here. I am not sure why it uses double \, but I just copied the example of how the previous keys were set up and this seemed to work best.
  • The Description is not needed, but obviously any description can be used.
  • 数字“14.0”是 MS Office 的版本。您可以简单地将其更改为代表您正在运行的版本的数字。
  • “Location20”是一个独特的名字,我们分配。20 可以是任何尚未使用的数字。其他程序,包括默认的 MS Access 向导,可能已经使用了其他编号。或者,如果您希望将多个路径作为受信任位置,则每个位置必须以不同的数字结尾。
  • “C:\数据库\”实际上是要设置为受信任位置的物理路径。您可以在此处放置您选择的任何路径。我不知道为什么它使用双 \,但我只是复制了如何设置以前的键的示例,这似乎效果最好。
  • 不需要描述,但显然可以使用任何描述。

For more details on how to make Trusted Locations work for your MS Access project, read our detailed explanation here: http://blog.ideaz.net/2013/12/how-to-remove-microsoft-access-security.html

有关如何使受信任位置适用于您的 MS Access 项目的更多详细信息,请在此处阅读我们的详细说明:http: //blog.ideaz.net/2013/12/how-to-remove-microsoft-access-security.html

回答by WWJ

  1. In Control Panel, click 'Internet Options'.
  2. In the 'Internet Properties' popup, select the 'Security' tab.
    • Select 'Local Intranet' zone.
    • Click 'Sites' button.
    • In the 'Local Intranet' popup, clear the "Automatically detect..." checkbox and set the following checkboxes:
      • "Include all local (Intranet) sites not listed in other zones"
      • "Include all network paths (UNCs)"
    • 'OK'.
  3. 'OK'.
  1. 在控制面板中,单击“Internet 选项”。
  2. 在“Internet 属性”弹出窗口中,选择“安全”选项卡。
    • 选择“本地内联网”区域。
    • 单击“站点”按钮。
    • 在“本地 Intranet”弹出窗口中,清除“自动检测...”复选框并设置以下复选框:
      • “包括其他区域中未列出的所有本地(Intranet)站点”
      • “包括所有网络路径 (UNC)”
    • '好的'。
  3. '好的'。

Now all Access dbs anywhere on your Intranet or any referenced by a UNC will open immediately without warning. You assess the convenience/security tradeoff.

现在,您的 Intranet 上任何位置或任何 UNC 引用的所有 Access dbs 都将立即打开,而不会发出警告。您评估便利性/安全性的权衡。

回答by Mark Brackett

Here's my notes from a similar, internal issue with Access 2003 a few years back:

这是几年前我在 Access 2003 的一个类似内部问题中的笔记:

Okay, so here's (evidently) the deal.

  • The network server was not in the Trusted Zone. Starting, IIRC, with SP2, this causes a Open/Save/Warning box when opening a file. By default, UNC paths are supposed to be in the Trusted Zone. I'm not sure why it wasn't, but here's the fix: Add server.dns and server to Internet Options->Security Zones->Local Intranet.
  • Unsafe Expressions Are Not Blocked. This is some ridiculously overcomplicated Access security model (Google for unsafe expressions and Access Sandbox Mode for more). Basically, Access (starting with 2003 and/or Jet 4.0 SP8, I think) warns you if a registry key is not set to disallow "unsafe expressions". The fix: Set HKLM\Software\Microsoft\Jet\4.0\Engines\SandBoxMode to 3, which blocks "unsafe expressions" for anything using Jet. This has to be done by an Administrator. Alternatively, I think that answering "Yes" to the Block Unsafe Expressions prompt as Administrator sets that key for you.
  • This file may not be safe to open. This is an easy one, and follows the whole macro security model in Office. Just set the Tools->Macro->Security (don't look in the Tools->Security menu...that'd be too obvious) to Low.
BTW, I still have no idea what an "unsafe expression" is - nor why it continually asks to upgrade to Jet 4.0 SP8 when it already has been (I verified that it was updated by checking the file versions). But with those changes, it no longer asks anything when starting up. --MB

好的,这就是(显然)交易。

  • 网络服务器不在受信任区域中。从 IIRC 开始,使用 SP2,这会在打开文件时导致打开/保存/警告框。默认情况下,UNC 路径应该位于受信任区域中。我不知道为什么不是,但修复方法如下:将 server.dns 和服务器添加到 Internet 选项-> 安全区域-> 本地 Intranet。
  • 不安全的表达式不会被阻止。这是一些非常复杂的访问安全模型(谷歌表示不安全表达式,访问沙盒模式更多)。基本上,如果注册表项未设置为禁止“不安全的表达式”,Access(我认为从 2003 和/或 Jet 4.0 SP8 开始)会警告您。修复:将 HKLM\Software\Microsoft\Jet\4.0\Engines\SandBoxMode 设置为 3,这会阻止任何使用 Jet 的“不安全表达式”。这必须由管理员完成。或者,我认为以管理员身份对 Block Unsafe Expressions 提示回答“是”会为您设置该键。
  • 此文件可能无法安全打开。这是一个简单的方法,并且遵循 Office 中的整个宏安全模型。只需将 Tools->Macro->Security(不要在 Tools->Security 菜单中查看...这太明显了)设置为 Low。
顺便说一句,我仍然不知道什么是“不安全的表达” - 也不知道为什么它已经升级到 Jet 4.0 SP8(我通过检查文件版本确认它已更新)。但是随着这些变化,它在启动时不再询问任何事情。--MB