+ Reply to Thread
Results 1 to 6 of 6

How to use a flexible folder address rather than the current one?

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    London
    MS-Off Ver
    Excel 2003 Excel 2010
    Posts
    189

    How to use a flexible folder address rather than the current one?

    Hi, I found a macro below which can list ALL the file names in the same folder as the saved macro file. My question is: how to adapt the code to allow a more flexible folder as specified, for example, C:\Users.

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    01-16-2014
    Location
    London
    MS-Off Ver
    Excel 2003 Excel 2010
    Posts
    189

    Re: How to use a flexible folder address rather than the current one?

    I'm still looking for a help

    The location is:

    Set baseFolder = FSO.GetFolder(ThisWorkbook.Path)

    How can I change this to folder: C:\Users

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

    Re: How to use a flexible folder address rather than the current one?

    hi alice2011, try this option (new lines are underlined):

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    01-16-2014
    Location
    London
    MS-Off Ver
    Excel 2003 Excel 2010
    Posts
    189

    Re: How to use a flexible folder address rather than the current one?

    Hi watersev, I totally feel amazed by this great improvement of the code. The new one is very flexible to allow me to choose the folder. Really good . Hope others can use it too.

    Thanks for the great help.

  5. #5
    Forum Contributor
    Join Date
    01-16-2014
    Location
    London
    MS-Off Ver
    Excel 2003 Excel 2010
    Posts
    189

    Re: How to use a flexible folder address rather than the current one?

    Sorry to come back. I ran the code and it works ok. But sometimes it failed to work and issued an error message as:

    Run-time error '-2147217887 (80040e21)'):
    Multiple-step operation generated errors. Check each status value.

    The code may have some drawback behind which I don't know (I found it online).

    Anyone knows?

  6. #6
    Forum Contributor
    Join Date
    01-16-2014
    Location
    London
    MS-Off Ver
    Excel 2003 Excel 2010
    Posts
    189

    Re: How to use a flexible folder address rather than the current one?


+ 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. Entering current folder into a cell
    By Nimril in forum Excel General
    Replies: 3
    Last Post: 10-30-2013, 07:25 PM
  2. [SOLVED] Save worksheets in current folder as .pdf
    By Birdster in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-11-2013, 04:44 AM
  3. Get current cell address
    By The_Vulcan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-20-2006, 10:39 PM
  4. Dynamic flexible cell address
    By dewsbury in forum Excel General
    Replies: 2
    Last Post: 03-09-2006, 04:10 PM
  5. HELP! saving as xls in current folder
    By drumerboy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2006, 10:10 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