P
pareshtrivedi
How do I find out from VB code if the word application is going to
allow running macros? Is there any property I can check whether macros
are enabled or not?
Dim lword_app As Word.Application
Dim lword_document As Word.Document
Set lword_app = CreateObject("word.application")
lword_app.AutomationSecurity = msoAutomationSecurityByUI
Set lword_document = lword_app.Documents.Open("D:\test.doc",
Visible=True)
' need something like this
' if lword_document.macro_enabled =True then
' currently getting error here if macros are disabled
lword_app.Run ("test_macro")
allow running macros? Is there any property I can check whether macros
are enabled or not?
Dim lword_app As Word.Application
Dim lword_document As Word.Document
Set lword_app = CreateObject("word.application")
lword_app.AutomationSecurity = msoAutomationSecurityByUI
Set lword_document = lword_app.Documents.Open("D:\test.doc",
Visible=True)
' need something like this
' if lword_document.macro_enabled =True then
' currently getting error here if macros are disabled
lword_app.Run ("test_macro")