title: Create a word document (from excel) with a title, a paragraph, a table, a paragraph, a text, a paragraph, a table, a paragraph and a text
body: <p>I am trying to create a word document from excel.
  I think I can do it, but to fill the word document with what I want (a title, an empty paragraph, a table... wherever I want) give me some headache. I certainly don't master the word-vba, I find excel-vba easier.
  Below is my horrible code, but if you can give me a piece of code doing what is describe in the title, it could be a good starting point for me.</p>
  <pre><code>    Dim objWord As Object
      Dim objDoc As Object
      Dim objRange As Object
      Dim objTable As Object
      Dim txtword As String
      '-----------------------
      Set objWord = CreateObject(&quot;Word.Application&quot;)
      objWord.Visible = True
      Set objDoc = objWord.Documents.Add
      Set objRange = objDoc.Content 'Range
      '-----------------------
      txtword = &quot;Something&quot;
      With objRange
          .Text = txtword &amp; vbCr &amp; vbCr 'add the paragraph break at the end of the text string
          .Collapse Direction:=0
      End With
      Set objTable = objDoc.Tables.Add(objRange, 2, 8)
      objTable.Borders.Enable = True
      
      
      objRange.Text = txtword &amp; vbCr &amp; vbCr
      objRange.Collapse Direction:=0
      
      
      ' From direct Macro:
      'objRange.MoveDown Unit:=wdLine, Count:=3
      'objRange.TypeParagraph
      'objRange.TypeText Text:=&quot;Text&quot;
      'objRange.TypeParagraph
  
      
      ' HOW TO GET OUT OF THIS TABLE????
      
      
      'objRange.Text = &quot;&quot; &amp; vbCr
      'Set objRange = objDoc.Content
      'objRange.Collapse Direction:=0
      objDoc.Tables.Add Range:=objRange, NumRows:=2, NumColumns:=2
      
      '---------------------
      Set objTable = Nothing
      Set objRange = Nothing
      Set objDoc = Nothing
      Set objWord = Nothing
  </code></pre>