+ Reply to Thread
Results 1 to 2 of 2

I need a macro to open a file, but I don't want to hard code the path.

  1. #1
    Registered User
    Join Date
    04-21-2016
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    2016
    Posts
    26

    I need a macro to open a file, but I don't want to hard code the path.

    I have a Summary workbook the pulls data from new workers' logs via a macro called "Updateme"

    Currently, I need to update the "Updateme" macro in the summary work book for each hire group with the path to the directory where their training logs are located.

    I will be promoting out of my current position and will be handing the duty of maintaining these logs off to a co-worker.

    I want to code the updater so that the path to the logs does not need to be hard coded, but is variable as each hire group gets its own folder. My initial thought was to code a field in List.xlsx with the path listed for each worker, but then I realized that the path to List.xlsx is what I need to make indeterminate!

    I had the idea to use "Application.GetOpenFilename("*.xlsx") but I don't want the user to have to find the list.xlsx file every time.

    Is it possible to have the macro pull the directory from "Application.GetOpenFilename("*.xlsx") using something like:
    Please Login or Register  to view this content.
    and then have the macro write the directory or path in the macro for the future, once the path is known?

    Any ideas on how to do this?

    The relevant part of my existing macro is below.

    Please Login or Register  to view this content.
    Thanks for any help or ideas!
    Last edited by armlegx; 08-04-2016 at 04:59 PM.

  2. #2
    Registered User
    Join Date
    04-21-2016
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    2016
    Posts
    26

    Re: I need a macro to open a file, but I don't want to hard code the path.

    I think I have this solved. I was trying to be too complicated.

    The solution I have is this:
    Please Login or Register  to view this content.
    And this code can go into the Macro that creates the log and summary sheet so that the path location is located in the workbook the macro I was trying to update is located in, so when it comes time to run that macro, it does not need outside input.

+ 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. VB code to open a file from a path which contains certain texts
    By shreeja178 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-15-2016, 08:03 AM
  2. vba code to open xlsm file from Network Path
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-06-2014, 04:18 AM
  3. [SOLVED] How to get a macro to open file using activesheet path
    By mbroxholme in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-16-2013, 10:31 AM
  4. consolidating excel files into one file not using hard code of folder path
    By rrakkki in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-21-2011, 09:05 AM
  5. Hard code path to refresh data from a csv file
    By R.Baxter in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-03-2009, 09:33 AM
  6. Open .CSV using macro with changing file path
    By jrhertel in forum Excel General
    Replies: 2
    Last Post: 03-13-2007, 11:23 AM
  7. Hard Code Folder Path for Browse Box
    By adamkozyra in forum Excel General
    Replies: 1
    Last Post: 02-01-2005, 10:41 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