View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general
Jonathan West Jonathan West is offline
external usenet poster
 
Posts: 13
Default How do I prevent AutoRun Macros when Programmatically Opening Workbook?


"Jezebel" wrote in message
...
Set the AutomationSecurity property to msoAutomationSecurityForceDisable
before opening the file. Remember to set it back when you've finished. Use
a sequence something like --

Dim pWord As Word.Application
Dim pDoc As Word.Document
Dim pSetting As MsoAutomationSecurity

Set pWord = New Word.Application
pSetting = pWord.AutomationSecurity
pWord.AutomationSecurity = msoAutomationSecurityForceDisable
Set pDoc = pWord.Documents.Open([FileName])
pWord.AutomationSecurity = pSetting


Jezebel,

You're answering the wrong question. You're describing how to open a Word
document from Excel. The question was how to open an Excel workbook from
Word.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org