+ Reply to Thread
Results 1 to 10 of 10

Open pdf file selected from excel

  1. #1
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Open pdf file selected from excel

    I am using this code to select a folder and diplay the pdf files in that folder..
    Please Login or Register  to view this content.
    Of course when I select a pdf, excel opens it and it becomes gibberish.
    How can the select file be opened with acrobat reader?
    xl2000

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485
    Use the SHELL command.
    Provide the path and name of the reader and the name of the pdf to open.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    Quote Originally Posted by Andy Pope View Post
    Use the SHELL command.
    Provide the path and name of the reader and the name of the pdf to open.

    Please Login or Register  to view this content.
    Thanks Andy,
    I have it as far as Acrobat opening, but it can't find the file selected :
    Please Login or Register  to view this content.
    What should be at the end of the shell line?

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485
    You need to more your variable outside to the quotes.

    Please Login or Register  to view this content.
    this assumes fn contains full path and file name. If not also include P

    If you must post your question elsewhere please include a link.

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    Darn, Now acrobat won't open.
    When I hover over the fn it shows the correct path and file name that was selected.

    When the fn is inside the quotes, acrobat opens but errors and says can't find file.

    When code looks like this
    Please Login or Register  to view this content.
    VBA error, can't find file

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485
    Are you sure your path to the reader is correct.
    Mine is,

    C:\Program Files\Adobe\Acrobat 7.0\Reader

    You appear to have,
    C:\Program Files\Adobe\Reader 8.0\Reader\

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    Yes it's the correct path, I just copied and pasted it into my code
    Here's an additional code I added,
    Please Login or Register  to view this content.
    the retVal opens Acrobat nicely but does not open the file selected

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485
    You have placed the file to open outside of the shell command

    Please Login or Register  to view this content.

  9. #9
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    Still get the Acrobat error
    This works though
    Please Login or Register  to view this content.
    Thank you very much,after researching the web, it looks like Abobe8 may have some issues,
    The Hyperlink code seems to open whatever file is selected in it's defaulted program, is this the case?

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485
    If version 8 if flakey then I would stick with the hyperlink approach if that works.

+ 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. HELP: Can no longer open excel file
    By Lou82 in forum Excel General
    Replies: 2
    Last Post: 01-19-2011, 02:06 PM
  2. To Open excel in the Selected Sheet
    By speedy_prabu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2008, 01:21 PM
  3. Determining relative file path macro
    By ctmurray in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-18-2007, 12:25 AM
  4. Color not the same when others open my excel file
    By caliskier in forum Excel General
    Replies: 3
    Last Post: 09-21-2007, 07:44 PM
  5. Code to open a Access file from excel?
    By comptechbranden in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-13-2007, 10:32 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