Henry64
01-13-2009, 05:50 AM
Hello
When I open a word document from excel I need to disable AutoOpen and AutoClose events. However I cannot get "DisableAutoMacros" or anything else to work.
I tried
wrdApp.WordBasic.DisableAutoMacros 1 'gave an error that the member was not found, I assume that's the DisableAutoMacros
I'm opening word like this
Public wrdApp As Word.Application
Public WordWasNotRunning As Boolean
Set wrdApp = GetObject(, "Word.Application")
If Err Then
Set wrdApp = CreateObject("Word.Application")
WordWasNotRunning = True
End If
' somewhere I need to prevent the auto macros from running
'......
Set wrdDoc = wrdApp.Documents.Open(DocName)
With wrdDoc
' I'm doing some work here
.Save
.AttachedTemplate.Saved = True
.Close ' close the document
End With
If WordWasNotRunning Then
wrdApp.Quit
End If
Set wrdApp = Nothing
When I open a word document from excel I need to disable AutoOpen and AutoClose events. However I cannot get "DisableAutoMacros" or anything else to work.
I tried
wrdApp.WordBasic.DisableAutoMacros 1 'gave an error that the member was not found, I assume that's the DisableAutoMacros
I'm opening word like this
Public wrdApp As Word.Application
Public WordWasNotRunning As Boolean
Set wrdApp = GetObject(, "Word.Application")
If Err Then
Set wrdApp = CreateObject("Word.Application")
WordWasNotRunning = True
End If
' somewhere I need to prevent the auto macros from running
'......
Set wrdDoc = wrdApp.Documents.Open(DocName)
With wrdDoc
' I'm doing some work here
.Save
.AttachedTemplate.Saved = True
.Close ' close the document
End With
If WordWasNotRunning Then
wrdApp.Quit
End If
Set wrdApp = Nothing