title: Opening the Word file in Excel
body: <p>I have managed with opening the Word file in Excel thanks to the help of some of you.</p>
  
  <p><a href="https://stackoverflow.com/questions/61407992/vba-excel-open-the-word-file-in-the-active-workbook-directory">Open the Word file in the active Workbook directory</a></p>
  
  <p><a href="https://stackoverflow.com/questions/60995114/vba-excel-problem-with-opening-the-word-file">VBA Excel problem with opening the Word file</a></p>
  
  <p>Unfortunately, I still have some smallish bugs in it. Whilst my word file is opened, the debugger says, that the script is out of range.
  Theoretically, I understand it, because we are jumping to the file, which is not directly served by VBA Excel, although is it possible to get rid of this error at all?</p>
  
  <p><a href="https://i.stack.imgur.com/1zb0T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1zb0T.png" alt="enter image description here"></a></p>
  
  <p>My code looks as follows:</p>
  
  <pre><code> Sub RamsOpen3()
   Dim appWD As Word.Application
   Set appWD = New Word.Application
   Dim docWD As Word.Document
   Set docWD = appWD.Documents.Open(ActiveWorkbook.path &amp; "\RAMS.docx.docm")
   appWD.Visible = True
   '
   ' Data is selected and copied into "Design"
   '
   'Copy all data from Design
   Sheets("Frontsheet").Select
   Range("D18").Copy
  ' Tell Word to create a new document
  
   appWD.Selection.Paste
  ' Save the new document with a sequential file name
   Sheets("Sheet1").Select
   appWD.ActiveDocument.SaveAs filename:=ThisWorkbook.path &amp; "/" &amp; "TEST" &amp; Range("C8").Text
  ' Close this new word document
  appWD.ActiveDocument.Close
  ' Close the Word application
   appWD.Quit
  End Sub
  </code></pre>