+ Reply to Thread
Results 1 to 4 of 4

Have user pick folder to run script

  1. #1
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Have user pick folder to run script

    Hi,
    I have a script that runs through all the workbooks in a folder However the path is hard coded. What I would like to do is use part of the hard code path but have the user pick the last folder that contains the files the script would run on. I tried to use the application getopenfile but that only picks the file itself not the folder.

    Can someone help me modify this line of code to have the user pick the last folder?

    Please Login or Register  to view this content.
    Here is the entire script if it's of any help in solving the issue.

    Thanks For your help, Mike

    Please Login or Register  to view this content.
    Last edited by realniceguy5000; 09-29-2009 at 10:22 AM.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: Have user pick folder to run script

    Good afternoon realniceguy5000
    Quote Originally Posted by realniceguy5000 View Post
    Can someone help me modify this line of code to have the user pick the last folder?
    The GetOpenFileName instruction is great, but as you pointed out it's only useful for selecting a file, and there is no ready made instruction for selecting a folder.

    That said, there is a piece of code kicking around the internet that will allow you to open and utilise a "Browse for Folder" dialog, which seems perfect for your needs. John Walkenbach includes the whole code, plus a brief write up here.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,996

    Re: Have user pick folder to run script

    You can use this too:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  4. #4
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Have user pick folder to run script

    Quote Originally Posted by romperstomper View Post
    You can use this too:
    Please Login or Register  to view this content.

    Super, This option works great... Thanks Mike

    Also the link that dominicb provides has some great reading as well...

    Thanks for the help, Mike

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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