+ Reply to Thread
Results 1 to 9 of 9

Using a command button to open a PDF

  1. #1
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Using a command button to open a PDF

    I'm currently using this code to try and open a PDF but its not seeming to work.

    I currently have it in the sheet's code, but nothing is happening.

    Any suggestions? Should it be somewhere else?

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Re: Using a command button to open a PDF

    Oh:

    I forgot, i'm getting this error when I run it

    "Run-Time Error '-2147221014(800401ea)' : Cannot open the specified file."

  3. #3
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Using a command button to open a PDF

    Are you sure the file at that location exists?

    I had no problem running the code replacing your path with my own.

    Try navigating to the file with windows explorer and copy and pasting the path from that window.

  4. #4
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Re: Using a command button to open a PDF

    Yes, I'm sure. Where is your code located?

    I copied and pasted the address.
    Its location is in a drive that all computers in the company can access. Would that be a problem?
    Last edited by emilyloz; 06-05-2013 at 02:01 PM.

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Using a command button to open a PDF

    This is also to a shared location ran from Sheet1:

    Please Login or Register  to view this content.
    But its a location I have read/write access to. Do you have permissions set up to do so?

    It sounds to me like the filename/path you have typed isn't exactly as it is saved.

  6. #6
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Re: Using a command button to open a PDF

    hmm, i'm copying and pasting it directly from the properties window.

    Could it have something to do with adobe or how the file has been saved?

    I have all the permissions.

  7. #7
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Re: Using a command button to open a PDF

    ThisWorkbook.FollowHyperLink

    What exactly does this mean? am I supposed to have some type of hyper link in my sheet?

  8. #8
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Using a command button to open a PDF

    Sorry I don't think I looked at it closely enough the first time. If you are trying to run this from a button try this:

    Please Login or Register  to view this content.
    Placing your path between the quotes. Try placing it in a blank module.

  9. #9
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Re: Using a command button to open a PDF

    Yay it worked! it was the "Thisworkbook.path &"

    And I kept it in the sheet code, and it works fine!

    Thanks so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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