title: MS Access VBA check that Word has been closed?
body: <p>I have a project that requires me to open a document in Word and wait while the document is open.  The user then needs to edit the document, print it or save it and then they will close it manually.  When the document (or Word itself) is closed I would like to continue my VBA script in Access.</p>
  
  <p>I have the following code</p>
  
  <pre><code>If Len(Dir(sDocName)) &gt; 0 Then
      Dim wordApp As Word.Application
      Dim wordDoc As Word.Document
  
      ' Launch Word
      Set wordApp = New Word.Application
  
      ' Open the document
      With wordApp
          Set wordDoc = .Documents.Open(sDocName, , False)
  
          ' Pass data
          With wordDoc
              .Variables("bmArchitectCompanyName").Value = "Hello"
              .Variables("bmArchitectCompanyAddress").Value = "Hello"
              .Variables("bmArchitectCompanyPostCode").Value = "Hello"
              .Variables("bmArchitectContactFirstName").Value = "Hello"
              .Variables("bmProjectTitle").Value = ProjectTitle
              .Fields.Update
          End With
          .Visible = True
          .Activate
  
          Do Until wordApp Is Nothing
              ' Wait for Word to be closed
          Loop
  
          ' Display a success message
          MsgBox "Success!"
      End With
  End If
  </code></pre>
  
  <p>However, the do loop never exits.</p>
  
  <p>How do I check if the document I launched through VBA has been closed by the user from my VBA code?</p>