+ Reply to Thread
Results 1 to 4 of 4

EXCEL VBA OPENING and COPYING PDF

  1. #1
    Registered User
    Join Date
    12-11-2014
    Location
    Dallas, TX
    MS-Off Ver
    2010
    Posts
    10

    EXCEL VBA OPENING and COPYING PDF

    Hello,

    1. I've got code where i'm using Excel to open a PDF file. It then selects, copies and pastes the data in to my Excel workbook. I just discovered some of but not all of the pdf files have more than one page. My current script is only picking up the first page of the pdf file. Is there anyway for me to select all pages and perform the same function?

    2. The initial line of my code identifies the adobe file to open. the filename will be changing each month based on the date in the filename. Is there a way to account for this using a wildcard, etc for the filename i'm opening?

    I'm still fairly new to vb and any assistance would be greatly appreciated. Thank you all in advance for your time and assistance.

    Scott

    Sub StartAdobe()

    Dim AdobeApp As String
    Dim AdobeFile As String
    Dim StartAdobe As Long

    AdobeApp = "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"
    AdobeFile = "X:\ProgramActivity_HealthPlans_PeachState2014_Oct2014.pdf"

    StartAdobe = Shell("" & AdobeApp & " " & AdobeFile & "", 1)

    Application.OnTime Now + TimeValue("00:00:05"), "FirstStep"

    End Sub

    Private Sub FirstStep()

    SendKeys ("^a")
    SendKeys ("^c")

    Application.OnTime Now + TimeValue("00:00:10"), "SecondStep"

    End Sub

    Private Sub SecondStep()

    AppActivate "Microsoft Excel"

    Range("A1").Activate

    SendKeys ("^v")

    End Sub

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: EXCEL VBA OPENING and COPYING PDF

    I don't know why it wouldn't select the whole document. If I manually do a Ctrl-A in a pdf file, it selects all the text. You might try that and see.

    To allow for selecting the file to open, use
    Please Login or Register  to view this content.
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Registered User
    Join Date
    12-11-2014
    Location
    Dallas, TX
    MS-Off Ver
    2010
    Posts
    10

    Re: EXCEL VBA OPENING and COPYING PDF

    It selects all the text but only the first page that pops up when i open the pdf. If there is more than one page in the document it only highlights the first page. If i could get it to enable scrolling when first opened it looks like the ctrl A will select all regardless of the amount of pages in the document. Is there a s code for that? Maybe a sendkey??

  4. #4
    Registered User
    Join Date
    12-11-2014
    Location
    Dallas, TX
    MS-Off Ver
    2010
    Posts
    10

    Re: EXCEL VBA OPENING and COPYING PDF

    I actually was able to figure out how to select all pages when opening. I found a preference setting in Adobe that will allow me to select all. Now my only issue is seeing if i can use a wildcard to select my adobe file since the name changes monthly

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 05-31-2014, 02:05 AM
  2. Opening 4 excel files, copying set table data and pasting into "master file".
    By Belloni in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-29-2012, 09:50 AM
  3. macro for opening all excel files and copying contents
    By roshinpp_77 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-30-2006, 08:18 AM
  4. opening & copying to a workbook
    By mwc0914 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2005, 02:12 PM
  5. Opening ,copying, access query resultsfrom Excel
    By Danail in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-27-2005, 08:06 PM

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