Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 27 of 27

Thread: Button to Search Subfolders for files

  1. #21
    VBAX Regular
    Joined
    May 2015
    Location
    New Plymouth, New Zealand
    Posts
    38
    Location
    Quote Originally Posted by mancubus View Post
    you are welcome.


    for RTE 52:
    do names of the files or folders contain, lets say, non-english characters?
    Mancubus, nah there arent any non-english characters as far as i am aware?

    apo, your code almost achieves what i'm after except that it places " " marks at either end of the string when in the spreadsheet?? Also it keeps the file extension in the string but, I can use this to my advantage in another function i'm writing.

    Luke
    Last edited by lkelsen; 06-22-2015 at 09:47 PM.

  2. #22
    VBAX Regular
    Joined
    Jul 2013
    Posts
    56
    Location
    Try changing it to:

    Z = Split(Replace(Replace(CreateObject("wscript.shell").exec("cmd /c forfiles /P " & fPath & " /S /M  *.xl?? /c ""cmd /c echo  @file """).stdout.readall, Chr(32) & Chr(34), ""), Chr(34), ""), vbCrLf)

  3. #23
    VBAX Regular
    Joined
    May 2015
    Location
    New Plymouth, New Zealand
    Posts
    38
    Location
    Works perfect thank you apo!

  4. #24
    VBAX Regular
    Joined
    Jul 2013
    Posts
    56
    Location
    Also..

    To just get the filename (no extension)..

    Replace @FILE with @FNAME in that line of code..

    See here:

    https://technet.microsoft.com/en-au/.../cc753551.aspx

  5. #25
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    Although an interesting option, on my XP system I wasn't able to get any result.

  6. #26
    VBAX Regular
    Joined
    Jul 2013
    Posts
    56
    Location
    I read somewhere that (for XP) you can download the Forfiles.exe and copy it to: C:\ windows\system32

    I don't have XP.. I wonder if that will make it work..

  7. #27
    VBAX Regular
    Joined
    May 2015
    Location
    New Plymouth, New Zealand
    Posts
    38
    Location
    Quote Originally Posted by apo View Post
    Also..

    To just get the filename (no extension)..

    Replace @FILE with @FNAME in that line of code..

    See here:

    https://technet.microsoft.com/en-au/.../cc753551.aspx
    Awesome, works great!

    All of you here have been such a great help which i appreciate, as for me everything is trial and error with my entry level understanding of VBA, and even having the mind of approach to programming in general.

    No obligation snb, mancubus and apo, but are you able to explain how each part of your code works? Always nice to know why it does this, that and so on..

    Cheers,

    Luke

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •