title: Check if Word Document is already opened + Error Handling
body: <p>Hello and thank you for your answers in advance.</p>
  
  <p>I am opening a word document using excel-vba and save it under a new name. 
  This is actually working fine. </p>
  
  <p>But problems occur if the word document with the new name is already opened!</p>
  
  <p>Let's say there is a button to run the script and the user runs it the second time, and has the created file still opened. The user might change something in excel and now wants to check how the new word document would look like afterwords. He will click the button again. 
  It will open the template (do all changes) and try to save it, but can't because it is already opened and it might save this document with the old name (template) instead of a new file. Therefor it will overwrite and destroy the template file (got this several times during testing)! </p>
  
  <p>Therefore I am in need of some proper code and a better Error-Handling. My first thought is to check if the document with the filename already exists. But it does not quite do its job:</p>
  
  <pre><code>Sub CreateWordDocument()
      Dim TemplName, CurrentLocation, DocumentName, Document As String
      Dim WordDoc, WordApp, OutApp As Object
  
      With table1
          TemplName = table1.Range("A1").Value 'Get selected template name
          CurrentLocation = Application.ActiveWorkbook.Path 'working folder
          Template = CurrentLocation + "\" + TemplName
          DocumentName = .Range("A2").Value
          Document = CurrentLocation + "\" + DocumentName + ".docx"
  
      'Open Word Template
      On Error Resume Next 'if Word is already running
      Set WordApp = GetObject("Word.Application")
      If Err.Number &lt;&gt; 0 Then
          'Launch a new instance of Word
          Err.Clear
          Set WordApp = CreateObject("Word.Application")
          WordApp.Visible = True 'Make the application visible to the user
      End If
  
      'if document is already opened in word than close it
      'if its not possible to close it - end application to prevent any damage to the template
      On Error GoTo notOpen
          Set WordDoc = WordApp.Documents(DocumentName + ".docx")
      On Error GoTo closeError
          WordDoc.Close
      notOpen:
          'Open the template
          Set WordDoc = WordApp.Documents.Open(Filename:=Template, ReadOnly:=False) 'Open Template
      'save with new name
      WordDoc.SaveAs Document
      closeError: 
      'open a message box and tell user to close and run again.
  </code></pre>
  
  <p>At the current stage it just jumpes from "Set WordDoc = WordApp. ..." to notOpened. Any suggestions how to solve this issue?</p>