title: Microsoft Access 2007 read from a Template
body: <p>Am migrating an access database from 2000 to 2007. I have a function that opens a template and runs a macro inside it. It is perfectly working in 2000 but not in 2007. This is the code:</p>
  
  <pre><code>    Dim appWd As Word.Application
      Set appWd = GetObject(, "Word.Application")
      appWd.Application.Visible = True
      appWd.Parent.Windows(1).Visible = True
      AppActivate "Microsoft Word"
      appWd.run "macro_name"
  </code></pre>
  
  <p>The line appWd.Parent.Windows is reading the correct document but when the macro is executed , it is showing error 5151. But instead of template, when i use the original word document, macro is running.</p>
  
  <p>Any idea please.</p>