title: Object required: Set wdocSource = wd.Documents.Open
body: <p>I am currently working on a button on excel that can mail merge the data in excel into word docuements. So when it runs to the line</p>
  <pre><code>Set wdocSource = wd.Documents.Open(c.Cells(529, 6).Value)
  </code></pre>
  <p>as footnoted in the code, it has a bug of</p>
  <blockquote>
  <p>&quot;Run-time error'424' object required&quot;.</p>
  </blockquote>
  <p>I have already create and put the needed docuement in the path of <code>c.cells(529 .6)</code> but it just does not work.</p>
  <p>Other wdocSource work just fine, it can mail merge the data into the word docuement specified in path of c.cells, such as c.cells(48, 6).</p>
  <p>Here is some of the code. Others are just repeating similar stuff but on different condition, so no gonna show it here otherwise, it would be very long.</p>
  <pre><code>Private Sub CommandButton1_Click()
  Set c = ThisWorkbook.Worksheets(&quot;Path&quot;)
  Dim i As Integer
  
  i = 2
  Do Until Cells(i, 3) = &quot;&quot;
  
  If Cells(i, 2) = &quot;N&quot; Or Cells(i, 2) = &quot;n&quot; Or Cells(i, 2) = &quot;E&quot; Or Cells(i, 2) = &quot;e&quot; Or Cells(i, 2) = &quot;+&quot; Then
   
   Dim wd As Object
      Dim wdocSource As Object
  
      Dim strWorkbookName As String
      ' Word constants
      Const wdFormLetters = 0, wdOpenFormatAuto = 0
      Const wdSendToNewDocument = 0, wdDefaultFirstRecord = 1, wdDefaultLastRecord = -16
  
      On Error Resume Next
      Set wd = GetObject(, &quot;Word.Application&quot;)
      If wd Is Nothing Then
          Set wd = CreateObject(&quot;Word.Application&quot;)
      End If
      On Error GoTo 0
      'path = ThisWorkbook.Worksheets(&quot;path&quot;).Cells(1, 1)
      
      If Cells(i, 2) = &quot;N&quot; Or Cells(i, 2) = &quot;n&quot; Then
      If Cells(i, 31) = 1 Then
      
          If Cells(i, 5) = &quot;A&quot; Or Cells(i, 5) = &quot;B&quot; Or Cells(i, 5) = &quot;C&quot; Or Cells(i, 5) = &quot;D&quot; Or Cells(i, 5) = &quot;E&quot; Then
              Set wdocSource = wd.Documents.Open(c.Cells(48, 6).Value)'this and others work just fine
  
          ElseIf Left(Cells(i, 5), 24) = &quot;F&quot; Or Left(Cells(i, 5), 17) = &quot;G&quot; Then
              Set wdocSource = wd.Documents.Open(c.Cells(529, 6).Value) '**The mentioned error occurs here**.
  
          'repeating code...
  
          End if
      End if
      End if
  End if
  
      strWorkbookName = ThisWorkbook.Path &amp; &quot;\&quot; &amp; ThisWorkbook.Name
  
      wdocSource.MailMerge.MainDocumentType = wdFormLetters
  
      wdocSource.MailMerge.OpenDataSource _
              Name:=strWorkbookName, _
              AddToRecentFiles:=False, _
              Revert:=False, _
              Format:=wdOpenFormatAuto, _
              Connection:=&quot;Data Source=&quot; &amp; strWorkbookName &amp; &quot;;Mode=Read&quot;, _
              SQLStatement:=&quot;SELECT * FROM [A$] where NO=&quot; &amp; i - 1
              
    With wdocSource.MailMerge
          .Destination = wdSendToNewDocument
          .SuppressBlankLines = True
          With .DataSource
              .FirstRecord = wdDefaultFirstRecord
              .LastRecord = wdDefaultLastRecord
          End With
          .Execute Pause:=False
      End With
  
      wd.Visible = True
      wdocSource.Close SaveChanges:=False
  
      Set wdocSource = Nothing
      Set wd = Nothing
  
  Else
      
  End If
  
  i = i + 1
  Loop
  
  End Sub
  </code></pre>
  <p>Please help!!</p>