Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default List of Folders

I need to be able to create a list of folders in a directory in an excel
spreadsheet. The spreadsheet is basically an index for users to use rather
than navigating through Windows Explorer.
I've tried different code off the web, but can't seem to find what I need.
Can anyone help me please?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default List of Folders

Check out this website and see if it gets you close enough:

http://www.vba-programmer.com/Snippe...d_Subdirs.html

HTH

Die_Another_Day

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default List of Folders

Thank you, but I can't get into the website. It may be my browser. I have a
lot of problems getting into most of the Microsoft websites, although I
realise this isn't a microsoft site.

"Die_Another_Day" wrote:

Check out this website and see if it gets you close enough:

http://www.vba-programmer.com/Snippe...d_Subdirs.html

HTH

Die_Another_Day


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default List of Folders

The free Excel add-in "List Files" will list files or folders from specified directories.
Download from... http://www.realezsites.com/bus/primitivesoftware
--
Jim Cone
San Francisco, USA

"marianne"
wrote in message
I need to be able to create a list of folders in a directory in an excel
spreadsheet. The spreadsheet is basically an index for users to use rather
than navigating through Windows Explorer.
I've tried different code off the web, but can't seem to find what I need.
Can anyone help me please?
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default List of Folders

thank you for the link. I tried the add-in but it takes too long and the
links don't work.

Marianne

"Jim Cone" wrote:

The free Excel add-in "List Files" will list files or folders from specified directories.
Download from... http://www.realezsites.com/bus/primitivesoftware
--
Jim Cone
San Francisco, USA

"marianne"
wrote in message
I need to be able to create a list of folders in a directory in an excel
spreadsheet. The spreadsheet is basically an index for users to use rather
than navigating through Windows Explorer.
I've tried different code off the web, but can't seem to find what I need.
Can anyone help me please?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default List of Folders

Marianne,

The "List Files" program only provides hyperlinks to files not folders.
However, if you select a folder name in the list and click the
orange/tan bar at the top of the list the folder opens.
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html



"marianne"

wrote in message
...
thank you for the link. I tried the add-in but it takes too long and the
links don't work.

Marianne

"Jim Cone" wrote:

The free Excel add-in "List Files" will list files or folders from specified directories.
Download from... http://www.realezsites.com/bus/primitivesoftware
--
Jim Cone
San Francisco, USA

"marianne"
wrote in message
I need to be able to create a list of folders in a directory in an excel
spreadsheet. The spreadsheet is basically an index for users to use rather
than navigating through Windows Explorer.
I've tried different code off the web, but can't seem to find what I need.
Can anyone help me please?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default List of Folders

"marianne" wrote:

I need to be able to create a list of folders in a directory in an excel spreadsheet.


I'll assume that you mean from an excel spreadsheet; I'll also assume that
your spreadsheet contains a list of folder names.

Try:

Create a module and add this declaration:

Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal
lpPath As String) As Long

Then

Sub CreateFolder(ByVal Folder as string)
MakeSureDirectoryPathExists Folder
End Sub


This code is tolerant:

1. If the folder exists, it will leave it untouched and not generate an error
2. If your folder is, say, c:\my folder\my user\tasks\, and say c:\my
folder\my user\ exixts already, it will simply create your folder i.e it will
create from scratch or complete the path.
3. Make sure that the folder ends with \

Write another sub to loop through your list (presumably in a column) and
call CreateFolder.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default List of Folders

I'm sorry, I mustn't have explained myself properly. I have a very long list
of folders in 1 particular directory, and they're a long way into the
directories. I would like to be able to list these folders in an excel
spreadsheet. So something with GetFolders(Foldername). This is so that users
will be able to just go to the folder they need without having to navigate
their way through Windows explorer.

Marianne

"AA2e72E" wrote:

"marianne" wrote:

I need to be able to create a list of folders in a directory in an excel spreadsheet.


I'll assume that you mean from an excel spreadsheet; I'll also assume that
your spreadsheet contains a list of folder names.

Try:

Create a module and add this declaration:

Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal
lpPath As String) As Long

Then

Sub CreateFolder(ByVal Folder as string)
MakeSureDirectoryPathExists Folder
End Sub


This code is tolerant:

1. If the folder exists, it will leave it untouched and not generate an error
2. If your folder is, say, c:\my folder\my user\tasks\, and say c:\my
folder\my user\ exixts already, it will simply create your folder i.e it will
create from scratch or complete the path.
3. Make sure that the folder ends with \

Write another sub to loop through your list (presumably in a column) and
call CreateFolder.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default List of Folders

Try:

Function EnumFldrs(ByVal Fldr As String) As String
Set xy =
CreateObject("Scripting.FileSystemObject").GetFold er("c:\OURFILES")
EnumFldrs = Fldr
For Each fle In xy.SubFolders
Select Case TypeName(fle)
Case "Folder"
EnumFldrs = EnumFldrs & "," & fle
End Select
Next
set xy=nothing
End Function

Sub xx()
Debug.Print EnumFldrs("c:\ourfiles")
End Sub

In sub xx, assign

fldlist = EnumFldrs("your folder")

This is a comma separated list of folders.

Split(fldList,",")

will create a 0 based array; use this as necessary: you might have to loop

"marianne" wrote:

I'm sorry, I mustn't have explained myself properly. I have a very long list
of folders in 1 particular directory, and they're a long way into the
directories. I would like to be able to list these folders in an excel
spreadsheet. So something with GetFolders(Foldername). This is so that users
will be able to just go to the folder they need without having to navigate
their way through Windows explorer.

Marianne

"AA2e72E" wrote:

"marianne" wrote:

I need to be able to create a list of folders in a directory in an excel spreadsheet.


I'll assume that you mean from an excel spreadsheet; I'll also assume that
your spreadsheet contains a list of folder names.

Try:

Create a module and add this declaration:

Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal
lpPath As String) As Long

Then

Sub CreateFolder(ByVal Folder as string)
MakeSureDirectoryPathExists Folder
End Sub


This code is tolerant:

1. If the folder exists, it will leave it untouched and not generate an error
2. If your folder is, say, c:\my folder\my user\tasks\, and say c:\my
folder\my user\ exixts already, it will simply create your folder i.e it will
create from scratch or complete the path.
3. Make sure that the folder ends with \

Write another sub to loop through your list (presumably in a column) and
call CreateFolder.

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default List of Folders

Correction:

Change

CreateObject("Scripting.FileSystemObject").GetFold er("c:\OURFILES")

to

CreateObject("Scripting.FileSystemObject").GetFold er(Fldr)




  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default List of Folders

Try this

Sub Finddir()
Dim FSO As Object
Dim fDir As Object
Dim fSubDir As Object
Dim i As Long
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fDir = FSO.GetFolder("C:\")
For Each fSubDir In fDir.SubFolders
i = i + 1
Cells(i, "A").Value = fSubDir.Name
Next fSubDir
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"marianne" wrote in message
...
I need to be able to create a list of folders in a directory in an excel
spreadsheet. The spreadsheet is basically an index for users to use rather
than navigating through Windows Explorer.
I've tried different code off the web, but can't seem to find what I need.
Can anyone help me please?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to list folders only, not files jat Excel Worksheet Functions 4 April 3rd 09 06:36 PM
List Folders using Excel Andibevan[_4_] Excel Programming 3 December 15th 05 09:44 AM
List of folders in a certain directory woolyhedgehog Excel Discussion (Misc queries) 1 October 19th 05 04:28 PM
List folders to file SS Excel Discussion (Misc queries) 13 August 28th 05 07:44 PM
Get folders list Eugene[_5_] Excel Programming 1 December 10th 03 10:44 AM


All times are GMT +1. The time now is 04:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"