In a number of recent threads, folkes have been wondering why AutoOpen is being invoked despite using WordBasic.DisableAutoMacros to disable AutoMacros.
Under normal circumstances, DisableAutoMacros seems to do what is intended.
Attempting to prove this, I constructed the crude example below.
1. Create a NEW Word template and include the code below.
2. Run the macros in the order indicated.
I believe that you will see the expected behavior.
Public Sub AutoOpen() MsgBox "AutoOpen in " & MacroContainer.FullName End Sub Option Explicit ' Run this first Public Sub RunMeFirst() Dim docWord As Word.Document Dim strFile As String Application.ScreenUpdating = False System.Cursor = wdCursorWait strFile = Options.DefaultFilePath(wdDocumentsPath) & Application.PathSeparator & CDbl(Now) ' Disable Auto macros WordBasic.DisableAutoMacros 1 Set docWord = ActiveDocument With docWord .AttachedTemplate = MacroContainer.FullName .SaveAs FileName:=strFile, addtorecentfiles:=False End With Debug.Print "Saved: " & strFile Documents.Add Template:=MacroContainer.FullName docWord.Close Documents.Open FileName:=strFile, addtorecentfiles:=False Debug.Print "Opened: " & ActiveDocument.FullName ' ' Enable Auto macros ' WordBasic.DisableAutoMacros 0 Application.ScreenUpdating = True System.Cursor = wdCursorNormal Set docWord = Nothing End Sub ' Run this second Public Sub RunMeSecond() Dim docWord As Word.Document Dim strFile As String Application.ScreenUpdating = False System.Cursor = wdCursorWait strFile = Options.DefaultFilePath(wdDocumentsPath) & Application.PathSeparator & CDbl(Now) ' ' Disable Auto macros ' WordBasic.DisableAutoMacros 1 Set docWord = ActiveDocument With docWord .AttachedTemplate = MacroContainer.FullName .SaveAs FileName:=strFile, addtorecentfiles:=False End With Debug.Print "Saved: " & strFile Documents.Add Template:=MacroContainer.FullName docWord.Close Documents.Open FileName:=strFile, addtorecentfiles:=False Debug.Print "Opened: " & ActiveDocument.FullName ' ' Enable Auto macros ' WordBasic.DisableAutoMacros 0 Application.ScreenUpdating = True System.Cursor = wdCursorNormal Set docWord = Nothing End Sub