Results 1 to 3 of 3

Convert from PDF to Excel with macro

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Convert from PDF to Excel with macro

    HI I have been reading so much about this and tried so many codes, but its like its not working always come up with an error. I need convert a pdf file to excel sheet with a macro. So i hope some have a solution would be really nice if it can be uploaded in a file here. I have attached a test pdf file. My Path for the file are.
    C:\Users\IBM_ADMIN\Desktop\Test.pdf

    My path to adobe reader is
    C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe

    I have really tried so many macroes uploaded but none are working. So if some have a solution with my test pdf and my version of adobe, it will really be great.-

    Below you can see some of the codes i have tried but not working. The first open the pdf file but it paste the macro code into the excel sheet.

    So none of them are working.

    Please have a look and maybe upload a sheet which are working. Would actually be very good with a openfile dialog for the pdf file. But have a look please.

    Thanks in advance

    Abjac

    My Not working codes.

    Public Sub PDFCopy()
    
        'Filepath for your Adobe reader
        MyPath = "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"
        'Filepath for your PDF to open
        MyFile = "C:\Users\IBM_ADMIN\Desktop\Test.pdf"
        Shell MyPath & " " & MyFile, vbNormalFocus
    
        SendKeys ("^a")
        SendKeys ("^c")
        SendKeys "%{F4}"
    
        Windows("convertadobe.xls").Activate
        Worksheets("Sheet1").Activate
        ActiveSheet.Range("A2").Select
    
        SendKeys ("^v")
    
    End Sub
    Sub Get_Pdf()
        Dim XLName As String, PDFPath As String, READERPath As String
        Dim OpenPDF, sh As Worksheet
    
        XLName = ThisWorkbook.Name
        Set sh = ThisWorkbook.Sheets(1)
        PDFPath = Application.GetOpenFilename(filefilter:="PDF file (*.pdf), *.pdf")
        If UCase(PDFPath) = "FALSE" Then Exit Sub
        '~~> Below path differs depending Adobe version and installation path
        READERPath = "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"
        Shell READERPath & PDFPath, vbNormalFocus: DoEvents
    
        Application.Wait Now + TimeValue("00:00:2")
    
        SendKeys "^a", True
        Application.Wait Now + TimeValue("00:00:2")
    
        SendKeys "^c"
        Application.Wait Now + TimeValue("00:00:2")
    
        Windows("convertadobe.xls").Activate
        sh.Paste sh.Range("A1")
        SendKeys "%{F4}", True
    End Sub
    Attached Files Attached Files
    Last edited by abjac; 04-14-2016 at 01:07 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Convert Word Table Macro to excel macro
    By vel90 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2015, 01:20 PM
  2. Trying to convert SQL Query to Macro/Excel VBA
    By udn3939 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-18-2014, 03:59 PM
  3. convert excel formula into macro
    By abraham30 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-03-2013, 09:36 PM
  4. [SOLVED] Macro to convert excel to R1C1
    By djwaz69 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-20-2012, 06:54 AM
  5. Need a excel macro to convert pdf to rtf
    By smartisenthil in forum Excel General
    Replies: 1
    Last Post: 04-14-2012, 10:06 AM
  6. CONVERT Excel Macro to Access?
    By gsurge in forum Access Programming / VBA / Macros
    Replies: 2
    Last Post: 06-01-2011, 11:12 AM
  7. Macro to convert pdf to excel
    By shekar goud in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-02-2010, 09:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1