title: Extract Data from PDF and Add to Worksheet
body: <p>I am trying to extract the data from a PDF document into a worksheet. The PDFs show and text can be manually copied and pasted into the Excel document.</p>
  
  <p>I am currently doing this through SendKeys and it is not working. I get an error when I try to paste the data from the PDF document. Why is my paste not working? If I paste after the macro has stopped running it pastes as normal.</p>
  
  <pre><code>Dim myPath As String, myExt As String
  Dim ws As Worksheet
  Dim openPDF As Object
  'Dim pasteData As MSForms.DataObject
  Dim fCell As Range
  
  'Set pasteData = New MSForms.DataObject
  Set ws = Sheets("DATA")
  If ws.Cells(ws.Rows.Count, "A").End(xlUp).Row &gt; 1 Then Range("A3:A" &amp; ws.Cells(ws.Rows.Count, "A").End(xlUp).Row).ClearContents
  
  myExt = "\*.pdf"
  'When Scan Receipts Button Pressed Scan the selected folder/s for receipts
  For Each fCell In Range(ws.Cells(1, 1), ws.Cells(1, ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column))
      myPath = Dir(fCell.Value &amp; myExt)
      Do While myPath &lt;&gt; ""
          myPath = fCell.Value &amp; "\" &amp; myPath
          Set openPDF = CreateObject("Shell.Application")
          openPDF.Open (myPath)
          Application.Wait Now + TimeValue("00:00:2")
          SendKeys "^a"
          Application.Wait Now + TimeValue("00:00:2")
          SendKeys "^c"
          'Application.Wait Now + TimeValue("00:00:2")
          ws.Select
          ActiveSheet.Paste
          'pasteData.GetFromClipboard
  
          'ws.Cells(3, 1) = pasteData.GetText
          Exit Sub
  
          myPath = Dir
      Loop
  
  Next fCell
  </code></pre>