0
How to locate a folder as a file?
For example, the code to locate the file TESTE.TXT
is:
b = dir("c:\minhapasta\t*.*xt")
msgbox b
But for folders the asterisk does not work. Which alternative we have?
0
How to locate a folder as a file?
For example, the code to locate the file TESTE.TXT
is:
b = dir("c:\minhapasta\t*.*xt")
msgbox b
But for folders the asterisk does not work. Which alternative we have?
1
Can(*) use the method GetDirectories()
class Directory to get the path of directories that are in the directory c:\minhapasta\
and that match the search pattern t*
Dim dirs As String() = Directory.GetDirectories("c:\minhapasta\", "t*", SearchOption.TopDirectoryOnly);
If you want the search to extend to subdirectories change the second parameter to SearchOption.AllDirectories
.
You can then use a For Each to go through each of these directories and get the paths to *.txt
(*) In VB, I believe that in VBA is equal.
Source: msdn
Browser other questions tagged vba ms-access
You are not signed in. Login or sign up in order to post.
Thank you very much Ramaral. it worked.
– Cláudio Zana