+ Reply to Thread
Results 1 to 8 of 8

Macro to open pdf file based on cell value

  1. #1
    Registered User
    Join Date
    01-12-2014
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    77

    Macro to open pdf file based on cell value

    Hello,

    I have managed to put up following codes to open pdf file and folder containing other files.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Can you guys please help in combining the above two macros, so that the macro will first try to open the pdf file and if it cannot find the file then open folder instead. Also to set an error message, if it cannot even open folder.

    Thank You!

  2. #2
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Macro to open pdf file based on cell value

    Try this
    FilePath variable created
    - Current file path ("C:\Users\Laxman\Documents\") exists so I think you are planning to have file paths determined within vba - otherwise message would not be required


    Please Login or Register  to view this content.
    If a response has helped then please consider rating it by clicking on *Add Reputation below the post
    When your issue has been resolved don't forget to mark the thread SOLVED (click Thread Tools at top of thread)

  3. #3
    Registered User
    Join Date
    01-12-2014
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    77

    Re: Macro to open pdf file based on cell value

    Thanks for helping me out kevin. When i run the macro without file in the folder, it is directly showing error message instead of opening folder.
    The macro was supposed to look for file. If the file is not found, open folder with out any error msg. If the user cannot access the folder then error msg be in place.

    Thank you for your time!

  4. #4
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Macro to open pdf file based on cell value

    Odd. It works ok for me.

    try amending
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    If that does not do the trick, please post your code for me (the whole sub)

  5. #5
    Registered User
    Join Date
    01-12-2014
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    77

    Re: Macro to open pdf file based on cell value

    That did not fix kevin. Macro is resulting only Message box. Following is the code.
    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Macro to open pdf file based on cell value

    This is exactly the same code

    What happens when you run:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-12-2014
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    77

    Re: Macro to open pdf file based on cell value

    I'm sorry kevin. The problem was that, i logged onto my system with different account, so my path was not holding good.
    The macro is working perfect. THANK YOU! very very much.

  8. #8
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Macro to open pdf file based on cell value

    You are welcome.
    Please go to top of thread and, under Thread Tools, mark thread as "solved"
    thanks

+ 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. Macro to open a file and folder that has date in the path based on a cell value
    By mm671750 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-07-2015, 06:31 PM
  2. How to get macro to open file name based on today's date?
    By ytc1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-05-2013, 05:37 AM
  3. Macro to open pdf file based on a cell value.
    By martin61 in forum Excel General
    Replies: 0
    Last Post: 12-15-2011, 11:48 PM
  4. Macro to open a file, input value into a cell, and run a macro from file
    By wkhor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-11-2011, 03:00 AM
  5. Open file based on cell value and paste data
    By aller01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2011, 04:29 PM
  6. Macro to open a file and search based on condition
    By jhc8255 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-15-2010, 01:33 AM
  7. Open file based on cell data
    By Sharp in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 08-15-2008, 05:01 AM

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