+ Reply to Thread
Results 1 to 7 of 7

Set path to a folder when macro starts

  1. #1
    Registered User
    Join Date
    07-03-2014
    Location
    Plano
    MS-Off Ver
    2010
    Posts
    26

    Set path to a folder when macro starts

    Hi,

    I have been trying to figure this out, but without any success. I have a macro that goes into a specific folder and merges all excel workbooks in that folder. What I want to do is that the user should be able to choose the path of the folder with all the excel workbooks when the macro starts running.

    Should be like this:
    1)Macro runs
    2)Dialog window pops up
    3)User chooses what folder where the workbooks are
    4)The path to this folder is stored in a string variable


    Thanks!

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,192

    Re: Set path to a folder when macro starts

    You MUST add the reference to the file dialog app in VBE menu, TOOLS, REFERENCES


    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Set path to a folder when macro starts

    hi sbidgol,

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-03-2014
    Location
    Plano
    MS-Off Ver
    2010
    Posts
    26

    Re: Set path to a folder when macro starts

    Watersev,

    very clean solution! Thank you so much!

    I assume folder2process is a string variable where the path will be stored. Right?

    Also, what does .Show = -1 mean?

    +rep
    Last edited by sbidgol; 07-28-2014 at 11:02 AM.

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Set path to a folder when macro starts

    that is correct

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Set path to a folder when macro starts

    Please Login or Register  to view this content.
    means the user pressed OK button

  7. #7
    Registered User
    Join Date
    07-03-2014
    Location
    Plano
    MS-Off Ver
    2010
    Posts
    26

    Re: Set path to a folder when macro starts

    Ok, thank you

+ 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. Code to list the folder path and sub folder path of a specific file
    By kalai1587 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2013, 03:51 AM
  2. [SOLVED] Open file by macro from active folder path
    By xbr088 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-26-2013, 10:11 PM
  3. Specified folder path to select file path
    By JayEmTee91 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2012, 10:38 AM
  4. Modifying Macro to Specify a Folder Path
    By DJBittner in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-25-2011, 02:37 PM
  5. Excel 2007 : Prefix a Path Folder in Macro
    By OrangeBoy in forum Excel General
    Replies: 2
    Last Post: 10-06-2011, 05:22 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