-
Thanks snb, that fixed the problem and this is working very well now, except for the flashing Cmd window. I'm having a hard time melding your fix for that into my code. Could you take a crack at adding the Cmd window fix into this code?
[vba]Sub TEST_getPathToFolder()
Dim findFolder As String ' the name of the folder being searched for
Dim ProjectFolder As String ' this folder contains findFolder at some level
findFolder = "folderPix" ' find the path to the folder named "folderPix"
ProjectFolder = "C:\Gridder" '
MsgBox getPathToFolder(ProjectFolder, findFolder)
End Sub
Function getPathToFolder(ParamArray sq()) As Variant
Dim V
V = Filter(Split(CreateObject("wscript.shell").exec("cmd /c Dir " & sq(0) & "\*. /b /s").StdOut.ReadAll, vbCrLf), sq(1))
If UBound(V) > -1 Then
getPathToFolder = V(0)
Else
getPathToFolder = False
End If
End Function
[/vba]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules