+ Reply to Thread
Results 1 to 3 of 3

Opening PDF from Local drive based on Cell value

  1. #1
    Registered User
    Join Date
    02-06-2024
    Location
    USA
    MS-Off Ver
    Microsoft 365
    Posts
    2

    Opening PDF from Local drive based on Cell value

    Hello, I have a .xlsm with several sheets. In each sheet, there is a list of values that represent files on my local drive. For example, Sheet 1 has a list of 50 or so numbers (01-123456) that have corresponding pdf files (01-123456-01.pdf) located on a local drive. Sheet 2, Sheet 3, Sheet4, and so on. I'd like to be able to click one of the cells (01-123456) and have it open the corresponding file in my PDF editor. I've looked around and saw someone post the below code that works for just one sheet. I think it would work if I create as many modules as I have Sheets, but this worksheet could have more sheets added at anytime and I'd like to not have to recreate another module each time a sheet is added. I have decent Excel skills, not extensive but decent. And little to no VBA experience. Any help would be much appreciated.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Opening PDF from Local drive based on Cell value

    Open visual basic, go to the insert menu, and select module. this will insert a standard module (Module1) into your current project. Paste the code there and it will work for which ever sheet is active.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    02-06-2024
    Location
    USA
    MS-Off Ver
    Microsoft 365
    Posts
    2

    Re: Opening PDF from Local drive based on Cell value

    I suppose I forgot to mention that there are several local folders that contain the pdf files. 01-123456 is in folder C, 07-891234 is in folder D, and so on. The folder structure is "C:\Users\Documents\Main\Category (A and B are subfolders)\Subject (C thru H+ are where the PDFs I'm trying to call are stored)". You are right that the above does work, but only to the one location. I need to be able to call from the Subject folders based on what each sheet corresponds to. And more Subject folders may be added. I apologize that I forgot to mention this earlier. Thank you for your response.

+ 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. [SOLVED] Save print preview as pdf in local drive
    By alferd324 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-25-2024, 09:14 PM
  2. Replies: 0
    Last Post: 05-10-2019, 08:45 AM
  3. VBA to Save file on a local drive
    By prat33 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-09-2017, 10:56 PM
  4. VBA - share name of a local drive
    By katto01 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-16-2013, 07:30 AM
  5. Windows XP : Local Drive Mapping
    By robzrob in forum Microsoft Windows Help
    Replies: 1
    Last Post: 02-13-2010, 07:07 PM
  6. How to Read all the filenames from Local drive ?
    By saikumar in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-04-2008, 06:15 AM
  7. backup to local drive when server disconnects
    By stoey in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-11-2008, 05:41 PM

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