title: Word VBA, is there a reason why this does work under Word 2003 Win XP but not Word 2007 Win 7
body: <p>I have a macro which works in Word 2003 running on Win XP, the macro is in normal.dot template the relevant part is below. It is run from a merged .rtf, copies the current document, opens a new document, pastes in the copied content along with some data from  userform combos, saves it in a custom named file, and closes it out leaving the user back where they started. It then goes on to FTP the saved document. It works as expected. </p>
  
  <pre><code>ActiveDocument.Content.Copy
  Documents.Add
  ActiveDocument.Content.Paste
  
  'Add the data from the Userform
  Selection.Find.ClearFormatting
  Selection.Find.Replacement.ClearFormatting
  With Selection.Find
   .ClearFormatting
   .Text = "\&lt;refDestination\&gt;*\&lt;End Synapse data\&gt;"
   .Replacement.ClearFormatting
   .Forward = True
   .Format = False
   .MatchCase = False
   .MatchWholeWord = False
   .MatchWildcards = True
   .Replacement.Text = "&lt;refDestination&gt;" &amp; ComboBox1 &amp; "&lt;/refDestination&gt;" &amp; _
                       "&lt;refType&gt;" &amp; ComboBox2 &amp; "&lt;/refType&gt;" &amp; _
                       "&lt;End Synapse data&gt;"
   .Execute Replace:=wdReplaceAll, _
    Wrap:=wdFindContinue
  End With
  
  
  ActiveDocument.SaveAs savedName, wdFormatDocument
  ActiveDocument.Close ' Now go on to FTP savedName
  
  MsgBox "wait here"
  </code></pre>
  
  <p>I am trying to run the same macro on a different site on Win 7 and Word 2007 and it fails, I cannot delete savedName as it is already open, in some way activedocument.close does not release the file, and the process hangs. If I use task manager to force word to close I can then go to the file at savedName and open it fine and it contains the right data, it just seems to stall on closing.</p>