Copying data from multiple pdf files

后端 未结 6 1150
太阳男子
太阳男子 2021-01-14 19:51

I have pdf files from which I would like to copy all the data to a column in a spreadsheet.

Here is the code I have. All it does is open the pdf, use control-a, then

6条回答
  •  無奈伤痛
    2021-01-14 20:27

    This is the more modified version of my above code it will not save any document it will save data in clipboard and will do the execution fast..

    Private Sub CommandButton3_Click()  '(load pdf)
    
    
       Dim o As Variant
    Set appWord = CreateObject("Word.Application")
     o = Shell("C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe C:\Users\saurabh.ad.sharma\Desktop\Book1.pdf2", vbNormalFocus)
     Application.Wait (Now + TimeSerial(0, 0, 2))
       SendKeys ("^a")
    SendKeys ("^c")
     SendKeys "%{F4}"
    Application.Wait Now + TimeValue("00:00:01")
     Set appWord = CreateObject("Word.Application")
     appWord.Visible = False
     appWord.Documents.Add.Content.Paste
    With appWord
    
           .Selection.WholeStory
           .Selection.Copy
           .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
           .Quit
    End With
    
    MsgBox " pdf is loaded "
    MsgBox " Paste to EXCEL "
    
    
       Set wkSheet = ActiveSheet
        wkSheet.Range("A1").Select
        wkSheet.Paste
    
    End Sub
    

提交回复
热议问题