+ Reply to Thread
Results 1 to 8 of 8

how to pull folders name from a path in excel

  1. #1
    Registered User
    Join Date
    06-09-2019
    Location
    india
    MS-Off Ver
    2013
    Posts
    29

    how to pull folders name from a path in excel

    Hello,
    Please someone can give me a vba code which can pull just the folder name from a path?

    I have some 1500 folders in a shared drive which is on a server mapped to my computer, how can I get all the 1500 folders name in an excel sheet?

    Any help is appreciated please.
    THanks

  2. #2
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: how to pull folders name from a path in excel

    Give the attached a shot.

    Unable to post a shell /stdout snippet here
    Attached Files Attached Files
    Teach me Excel VBA

  3. #3
    Registered User
    Join Date
    06-09-2019
    Location
    india
    MS-Off Ver
    2013
    Posts
    29

    Re: how to pull folders name from a path in excel

    On running the macro, a blank dialog box came which i pressed ok, but nothing it did, no names got listed on excel sheet.

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

    Re: how to pull folders name from a path in excel

    usage:
    ScanSubfolders "c:\myFolder"

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: how to pull folders name from a path in excel

    Ok

    I have made it dynamic a little bit. please run ListAllSubFolders subroutine and select a folder
    Attached Files Attached Files
    Last edited by ImranBhatti; 03-20-2020 at 11:20 AM.

  6. #6
    Registered User
    Join Date
    06-09-2019
    Location
    india
    MS-Off Ver
    2013
    Posts
    29

    Re: how to pull folders name from a path in excel

    it is giving an error debug at this below line:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-09-2019
    Location
    india
    MS-Off Ver
    2013
    Posts
    29

    Re: how to pull folders name from a path in excel

    When i run this, it says in a dialog box macro name and create option. This doesnt run the normal way a macro runs. Can you help please?

    Do I need to edit some of the code to input the path of the folder?

  8. #8
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: how to pull folders name from a path in excel

    Quote Originally Posted by tushjain00 View Post
    When i run this, it says in a dialog box macro name and create option. This doesnt run the normal way a macro runs. Can you help please?
    It happens when you run a function instead of subroutine

    I don't know you have a button for for the macro or not but if you want to run it from the VBE window then your cursor should be anywhere inside the ListAllSubFolders subroutine then press F5 and select a folder in the dialoge box that appears

+ 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] Macro to Unzip folders in a path
    By leebird in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-23-2018, 09:31 AM
  2. [SOLVED] Macro to Delete folders more than X MB from a given path
    By akhileshgs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-05-2014, 09:56 AM
  3. Variable .Attachment.Add path using Function to pull path from word table
    By aavelyn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-27-2013, 10:07 PM
  4. Replies: 0
    Last Post: 02-06-2013, 10:40 AM
  5. Need a Dynamic file path to pull the numbers from different closed excel files
    By vishnu01445 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-10-2012, 11:59 AM
  6. File path of DIrectory and Folders only
    By teachMeExcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2009, 11:02 PM
  7. [SOLVED] Trying to open folders in the Path
    By Davie in forum Excel General
    Replies: 1
    Last Post: 04-28-2005, 05:06 PM

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