Excel VBA信任中心设置 [英] Excel VBA Trust Center Settings

查看:704
本文介绍了Excel VBA信任中心设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一位经验丰富的Excel VBA程序员。我在一家大型银行工作,目前正在使用Excel 2007,Windows 7操作系统,Internet Explorer 9和Outlook 2007. 我的Excel VBA程序旨在与Java Web表单进行交互。 
子程序自动填充Web表单。 完成Web表单后,Outlook 12中将发送一封电子邮件,其中包含输入Java Web表单的大部分数据。  Excel VBA子程序通常可以正常工作,因为用户经过适当的培训并且在信任中心设置中启用了宏,因此只需

I am an experienced Excel VBA programmer. I work for a large bank which is presently using Excel 2007, the Windows 7 operating system, Internet Explorer 9 and Outlook 2007.  My Excel VBA program is designed to interface with a Java web form.  A subroutine populates the web form automatically.  Once the web form is complete, an email is sent in Outlook 12 containing a large portion of data inputted into the Java web form.  The Excel VBA subroutines generally work without a hitch, as long as the user is properly trained and macros have been enabled in the Trust Center Settings.

我有一个客户是谁遇到以下错误:"运行时错误1004:对VBA项目的编程访问不受信任"。问题是,已在其计算机上为Excel / VBA工作簿启用了宏。 VBA子程序
完美运行,直到某个时刻发生此错误。在我20年的Excel VBA编程中,我从未在处理过程中遇到过这种特殊错误;它始终是由于用户未在开始时调用宏而导致的。 

I have a client who is experiencing the following error: "Run Time Error 1004: Programmatic Access to VBA Project is Not Trusted". The issue is, macros have been enabled on their machine for the Excel/VBA workbook. The VBA subroutines operate flawlessly until, at some point, this error occurs. In my 20 years of Excel VBA programming, I have never experienced this particular error during processing; it has always occurred as the result of the user not invoking macros at the beginning. 

非常感谢您为此问题提供的任何建议。

Any advice you can offer for this issue is greatly appreciated.

Willburr

推荐答案

在大多数情况下,您可以运行一个小例程来检查是否允许访问VBA项目,如果没有建议用户做和中止 

In most situations you can run a little routine to check if access to the VBA Project is allowed, if not advise the user what to do and abort 

Sub abc()
If ProjectIsNA Then
    'abort
    Exit Sub
End If
' do stuff
End Sub

Function ProjectIsNA() As Boolean
    On Error Resume Next
    If Len(ThisWorkbook.VBProject.Name) Then
    End If
    If Err.Number Then
        MsgBox "This app needs access to VBA Project, please tick -" & vbCr & _
               "Options, Trust Center, Trust Center Settings, Macro settings, Trust Access to VBA Project"
    End If
End Function

但在某些情况下,该设置可能受组策略设置的限制,

However in some cases the the setting may be subject to group policy settings,

为Office 2013规划VBA宏的
安全设置


这篇关于Excel VBA信任中心设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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