title: Apply code to active document not document opened with Documents.Add
body: <p>I got a VBA project from colleague who is retired.</p>
  <p>I have to change a function:</p>
  <pre><code>Documents.Add Template:= _
      &quot;c:\word\Link.dot&quot;, _
      NewTemplate:=False, DocumentType:=0
  </code></pre>
  <p>Here a new document (another Word file) is created with a template.</p>
  <p>This template also relates data from another project &quot;Common&quot;.</p>
  <p>Basically, <code>Documents.Add Template:= _&quot;c:\word\Link.dot&quot;</code>
  in Link.dot the <code>Document_Open()</code> is executed and the Common project is initialized.</p>
  <pre><code>Private Sub Document_Open()
      Common.Initialize
  End Sub
  </code></pre>
  <p>I don't want a second document opened by <code>Documents.add</code>, it should use the already active document.</p>
  <p>I tried these two variants:</p>
  <p>#1</p>
  <pre><code>Dim oDoc As Document
  Set oDoc = ActiveDocument
  oDoc.AttachedTemplate = &quot;c:\word\Link.dot&quot;
  </code></pre>
  <p>#2</p>
  <pre><code>ActiveDocument.AttachedTemplate = &quot;c:\word\Link.dot&quot;
  </code></pre>
  <p>Nothing happens to both of them, even no Runtime Error. I think it's because Document_Open() wasn't executed.</p>