共用方式為


PowerPoint) (Application.AutomationSecurity 屬性

代表 Microsoft PowerPoint 在以程式開啟檔案時所使用的安全性模式。 讀取/寫入。

語法

expressionAutomationSecurity

expression 代表 Application 物件的變數。

傳回值

MsoAutomationSecurity

註解

此屬性會自動時設定為 msoautomationsecuritylow-會 啟動應用程式。 因此,若要避免中斷的預設設定依賴解決方案,您應該小心至 msoautomationsecuritylow-會 重設此屬性之後以程式設計方式開啟檔案。 此外,若要避免遭到惡意子版本,立即 before 及 after 以程式設計方式開啟檔案應該設定這個屬性。

DisplayAlerts 屬性的值不適用安全性警告。 例如,如果使用者將 DisplayAlerts 屬性等於 FalsemsoAutomationSecurityByUI ,將 AutomationSecurity 屬性使用者處於 [中型安全性層級時,將會有安全性警告時執行巨集。 這可讓設陷時仍會顯示安全性警告檔案如果成功中開啟的檔案開啟錯誤、 巨集。

AutomationSecurity 屬性的值可以是下列其中一個 MsoAutomationSecurity 常數。

常數 描述
msoAutomationSecurityByUI 會使用 [信任中心] 對話方塊中指定的安全性設定。
msoAutomationSecurityForceDisable 會停用以程式開啟之所有檔案中的所有巨集,而不會顯示任何安全性提醒。
msoAutomationSecurityLow 會啟用所有巨集。 這是應用程式啟動時的預設值。

範例

這則範例會擷取目前的自動化安全性設定、變更設定以停用巨集、顯示 [開啟舊檔] 對話方塊,並在開啟選取的簡報後,將自動化安全性變更回原來的設定。

Sub Security()

    Dim secAutomation As MsoAutomationSecurity



    secAutomation = Application.AutomationSecurity



    Application.AutomationSecurity = msoAutomationSecurityForceDisable

    Application.FileDialog(msoFileDialogOpen).Show



    Application.AutomationSecurity = secAutomation



End Sub

另請參閱

Application 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應