+ Reply to Thread
Results 1 to 9 of 9

VB Script to open multiple folders on HD & provide file property details.

  1. #1
    Registered User
    Join Date
    09-05-2017
    Location
    Indiana, USA
    MS-Off Ver
    2010
    Posts
    6

    Question VB Script to open multiple folders on HD & provide file property details.

    Hello all...

    I am creating a database spreadsheet for files I have on my hard drive. I found the script I want, and it works, but there are 2 functions I would like to have it do to smooth the process.

    What this code does is pulls all the files in 1 folder & gives me the data from the "Properties/Details" tab of the file. I found the information I want it to provide & its working like a charm. However the issue is, I need it to open the folders within the folder I selected.

    Example:
    Files I want are in: G:/#
    G:/A
    G:/B
    G:/C
    G:/D
    and so on until G:/Z

    If I select G:/ it just provides the folder names and not any files within those folders. If I select G:/# I get the files I wanted in that folder, but it won't pull from the other folders. So ultimately, I THINK (I am a self teacher of excel & am FAR from a pro, so you all please help if there is an easier process) what I need to do is add a code that will automatically selected the G drive when I run the macro (right now it has a popup window asking for the folder location) and then the code will repeat over and over to automatically go through each folder running the script until there is no more folders to open.

    I hope this made sense, I tried to be as detailed as possible but if someone would like to see my excel sheet I am working with, I won't mind sharing.

    Code is:
    Please Login or Register  to view this content.
    Thanks for any help provided in advance BTW I am running 2010
    Last edited by LauraShepherd-Boyd; 09-10-2017 at 08:11 AM. Reason: forgot the version of excel I have

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: VB Script to open multiple folders on HD & provide file property details.

    Please read the forumrules about crossposting.

    https://www.mrexcel.com/forum/excel-...y-details.html
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    09-05-2017
    Location
    Indiana, USA
    MS-Off Ver
    2010
    Posts
    6

    Re: VB Script to open multiple folders on HD & provide file property details.

    So does that mean you won't help or have an answer? Thanks!

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VB Script to open multiple folders on HD & provide file property details.

    Hello LauraShepherd-Boyd,

    How do you want the properties for each file to be saved? One under the other on the same worksheet or each on a separate worksheet?

    Do want only the files in the parent folder and it's first level of subfolders or all subfolders?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: VB Script to open multiple folders on HD & provide file property details.

    Hi Laura,

    It might take an hour to give you a good answer with our free time. If you ask the question to multiple forums, multiple people will spend time working on this problem. I'm pretty slow in posting a good answer so you might not even need it by the time someone else gives you an answer. SO.. If you post the question in multiple forums, we are less likely to want to spend our time to help with an answer. Does that makes sense?
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  6. #6
    Registered User
    Join Date
    09-05-2017
    Location
    Indiana, USA
    MS-Off Ver
    2010
    Posts
    6

    Re: VB Script to open multiple folders on HD & provide file property details.

    @MarvinP

    Thank you. I appreciate you giving me an explanation - that came across much better then what was said to me before & yes, that makes total scene! I was planning to just ask here until I saw the line above my post that read:
    Please Login or Register  to view this content.
    Then I went to another forum to ask because I figured I wasn't going to get any answer, or have my question seen unless I paid. So, yes & thank you.

    @Leith Ross

    Quote Originally Posted by Leith Ross View Post
    How do you want the properties for each file to be saved? One under the other on the same worksheet or each on a separate worksheet?
    This is still a work in progress, but saving them in the same tab would probably be best that I will have named "RAW_DATA_PULL". I have the arrays set up to pull and it currently looks like this:
    Please Login or Register  to view this content.
    So when it MANUALLY MAKES ME SELECT a folder, I Select the G:/# and my result comes back on my currently active sheet like this:
    Excel Example.png

    I then have other scripts & codes on other sheets that will pull certain data from it. But this will need a button to call the macro so it can be updated when I add new movies to the folders.

    Quote Originally Posted by Leith Ross View Post
    Do want only the files in the parent folder and it's first level of subfolders or all subfolders?
    As for Subfolders, there is only 1 level of subs. There is no other folders inside the "Letter" folders.

    So structure is:

    Parent G:/ Level 1
    Sub G:/# Level 2
    File G:/#/File#1.mp4 Inside Level 2
    File G:/#/File#2.mp4 Inside Level 2
    File G:/#/File#3.mp4 Inside Level 2
    File G:/#/File#4.mp4 Inside Level 2
    Sub G:/A Level 2
    File G:/A/File#1.mp4 Inside Level 2
    File G:/A/File#2.mp4 Inside Level 2
    File G:/A/File#3.mp4 Inside Level 2
    File G:/A/File#4.mp4 Inside Level 2
    Sub G:/B Level 2
    File G:/B/File#1.mp4 Inside Level 2
    File G:/B/File#2.mp4 Inside Level 2
    File G:/B/File#3.mp4 Inside Level 2
    File G:/B/File#4.mp4 Inside Level 2
    Sub G:/C Level 2
    File G:/C/File#1.mp4 Inside Level 2
    File G:/C/File#2.mp4 Inside Level 2
    File G:/C/File#3.mp4 Inside Level 2
    File G:/C/File#4.mp4 Inside Level 2

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VB Script to open multiple folders on HD & provide file property details.

    Hello LauraShepherd-Boyd,

    Here is the updated macro. It will let you select the folder. All folders in the in the parent folder are then opened one by one. The files in each folder are then listed on the active worksheet with the details you provided.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-05-2017
    Location
    Indiana, USA
    MS-Off Ver
    2010
    Posts
    6

    Re: VB Script to open multiple folders on HD & provide file property details.

    Awesome, thank you very much Leith!! I have to get to bed, since I have to be up early for work and it's already after midnight here... but I will take a look at this and apply it to my workbook and try to tinker with it a bit to try and learn what you did!! Thanks for the comment notes too!! That helps to learn as well!! I may have questions once I get looking good at this Thanks again.

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VB Script to open multiple folders on HD & provide file property details.

    Hello Laura,

    You're welcome. I would be happy to answer your questions and teach you about the Shell.

+ 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] List all files in Directory and Subdirectory with File Property Details
    By Green Crocodile in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-26-2016, 09:59 PM
  2. [SOLVED] Cant open a file with my script please help me out
    By elmnas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2015, 06:05 AM
  3. Script or .bat needed to open office file file located in LAN
    By 823 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-28-2015, 11:06 AM
  4. VBA code to open folders and pdf file inside the folders
    By kirtesh250187 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2013, 03:17 AM
  5. Replies: 0
    Last Post: 04-15-2013, 06:54 AM
  6. open file by searching root and sub folders
    By slipperyjim in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-05-2009, 10:42 AM
  7. [SOLVED] File Open doesn't display all directories (List vs Details)
    By OakCity in forum Excel General
    Replies: 4
    Last Post: 09-01-2005, 09:05 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