CurrentProject.IsTrusted 属性 (访问)

获取当前项目中是否启用了宏和Visual Basic for Applications (VBA) 代码。 只读 Boolean。

语法

表达式。IsTrusted

表达式 表示 CurrentProject 对象的变量。

示例

以下示例显示如何使用宏中的 IsTrusted 属性来确定是否已在启用信任的情况下打开数据库。 如果已启用信任,则调用 Visual Basic for Applications (VBA) 子例程 Init。 否则,将通知用户数据库已以禁用模式打开。

    If [currentproject].[istrusted] Then
        RunCode
            Function Name =Init()

    Else
        MessageBox
            Message The application is opened in disabled mode. Please enable the application for full functionality.
            Beep Yes
            Type None
            Title Disabled Mode Check

    End If

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。