title: VBA For loop to copy cells from excel to word
body: <p>I'm trying to create an excel macro to copy cells from excel to word. I need to take it from sheet 1 in excel to table 1 in word.</p>
  
  <p>I need to do this via a loop (as I have to perform operations on the cells etc.) and I can't work out how to do it.
  I have the following code:</p>
  
  <pre><code>Sub test()
  
  Dim wdDoc As Object
  Dim FileName As String
  Dim iRow As Integer
  Dim iCol As Integer
  
  'Open Word file
  FileName = ActiveWorkbook.Path &amp; "\Template.doc"
  Set wdApp = New Word.Application
  Set wdDoc = wdApp.Documents.Open(FileName)
  
  
  
  ' Loop through columns and rows
  For iCol = 1 To 3 ' or however many columns you have
      For iRow = 1 To 2
  
      With Worksheets("Sheet1").Cells(iRow, iCol)
          ' Copy the cell to the destination
          .Copy
          wdDoc.Selection.Paste
      End With
  
      Next iRow
  Next iCol
  
  End Sub
  </code></pre>
  
  <p>When I run this though, the line <strong>wdDoc.Selection.Paste</strong> gives the error:</p>
  
  <blockquote>
    <p>Run-time error '438': Object does not support this property or method.</p>
  </blockquote>
  
  <p>I'm also aware that this doesn't paste into table 1 of the document, but right now it doesn't do <em>anything</em>, so I thought I'd work on that first.
  I'm new to VBA but have other programming experience. Can someone please help me?</p>