Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get folder name

Status
Not open for further replies.

matrixindicator

IS-IT--Management
Sep 6, 2007
418
BE
Hoy, in .php you can get the folder name out of an URL.

Code:
$dir = opendir("support/desktop/documents/general"); 

// loop through the directory contents 
while($file = readdir($dir)) { 
    //output contents to the browser 
    echo $file . "<br>"; 
}

This is a VBA access forum. I need to get something similar in VBA to get the name of a folder, are there some methods or ways to do so ?
 
I'd have a look at using the FileSystemObject (you'll need a reference to MicroSoft Scripting Runtime).

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Yes. You can use Dir.

Code:
Thedir = dir("support/desktop/documents/general")
' loop through the directory contents 
Do While TheDir<>""
  DirList=DirList & vbcrlf & TheDir
  Thedir = dir 
  'output contents 
  Debug.Print DirList
Loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top