设置Excel文件的MsoAutomationSecurity
我正在尝试使用vb.net设置宏的设置。 正如我在MSDN网站上看到的那样( ),要启用所有宏,应将其设置为设置Excel文件的MsoAutomationSecurity,excel,vb.net,Excel,Vb.net,我正在尝试使用vb.net设置宏的设置。 正如我在MSDN网站上看到的那样( ),要启用所有宏,应将其设置为msoAutomationSecurityLow。但是在我的代码中,在设置枚举之后。什么也没发生。我应该在vb.net中打开Excel文件,然后设置自动安全性吗?或者这就足够了(如果是,那么为什么打开Excel文件后什么都没有发生?)有人能帮我解决这个问题吗?谢谢你和问候 这是我正在研究的代码: Private Sub ExcelSecurity() Try
msoAutomationSecurityLow
。但是在我的代码中,在设置枚举之后。什么也没发生。我应该在vb.net中打开Excel文件,然后设置自动安全性吗?或者这就足够了(如果是,那么为什么打开Excel文件后什么都没有发生?)有人能帮我解决这个问题吗?谢谢你和问候
这是我正在研究的代码:
Private Sub ExcelSecurity()
Try
Dim ExcelApp As New ExcelApplication.Application
Dim ObjSecurity As Microsoft.Office.Core.MsoAutomationSecurity
ObjSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityLow
ExcelApp.AutomationSecurity = ObjSecurity
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub