title: How to save a Word template file as a .docx in VBA? Or create multiple specific documents from one excel sheet?
body: <p>I am trying to copy a bunch of text data from an excel spreadsheet into multiple separate word documents (one excel row = one document, but each column's heading has to be included before the text from the respective field of the row). I also want these documents' names to be the text from specific fields in the spreadsheet (row headers).</p>
  <p>Because I want fancy formatting, and a specific order of copying/pasting things (not all fields are included), I am using a word template with bookmarks that I can feed into VBA. It fills the template well, but I cannot save it as a standard word document before repeating the loop. I get the error 'Object doesn't support this property or method'. Is there a way to overcome it, or a more elegant method I've missed?</p>
  <p>Here is the code:</p>
  <pre><code>Sub Primitive()
  
  Dim objWord As Object
  Dim ws As Worksheet
  Dim i As Integer
  
  
     
      Set ws = ThisWorkbook.Sheets(&quot;Sheet1&quot;)
      i = 2 ' First row to process
      'Start of loop
      Do Until ws.Range(&quot;B&quot; &amp; i) = &quot;&quot;
           Set objWord = CreateObject(&quot;Word.Application&quot;)
           objWord.Visible = True
       'Change to local path of template file
       
  
           objWord.Documents.Open &quot;C:path of template file.dotx&quot;
           With objWord.ActiveDocument
  
  
                .Bookmarks(&quot;FirstBookmark&quot;).Range.Text = ws.Range(&quot;B&quot; &amp; i).Value &amp; &quot; &quot; &amp; ws.Range(&quot;C&quot; &amp; i)
                .Bookmarks(&quot;headlineZ&quot;).Range.Text = ws.Range(&quot;Z1&quot;).Value
  </code></pre>
  <p>lots of this^ here to arrange the data right in the document</p>
  <pre><code>           
                NewFileName = &quot;C:\path of where I want the new file&quot; &amp; ws.Range(&quot;C&quot; &amp; i).Value &amp; &quot;.docx&quot;
  </code></pre>
  <p>This is the line that gives the error 483:</p>
  <pre><code>    objWord.SaveAs2 Filename:=&quot;NewFileName&quot;
      End With
      
  
      objWord.Close
  
   Set objWord = Nothing
          
  
                
          i = i + 1
          Loop
     
  
  
  End Sub
  </code></pre>