Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Aquiring Directory names


Works great, except it comes back with subfolders...

3 Folders named EG1, EG2, and EG3, site in location...

X:/EXAMPLE/EXAMPLE/

there are furthur subfolders within eg1, eg2, and eg3.

how can i adjust this so the ONLY list that is displayed on th
worksheet is the original folder names... EG1, EG2, EG3

(obviously EG1,2,3 will change)

Is it possible to mask the location too?

As in all that shows in the sheet (folders) will be EG1,EG2, an
EG3...

no p:/EXAMPLE/EXAMPLE/

MANY THANKS AGAIN!

Antoni

--
aking198
-----------------------------------------------------------------------
aking1987's Profile: http://www.excelforum.com/member.php...fo&userid=1539
View this thread: http://www.excelforum.com/showthread.php?threadid=31375

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Aquiring Directory names

Sod's law. Most people want sub-folders as well <vbg

Try this

Dim FSO As Object
Dim cnt As Long
Dim arfiles

Sub Folders()
Dim i As Long
Dim sFolder As String
Dim Folder As Object
Dim fldr As Object

Set FSO = CreateObject("Scripting.FileSystemObject")

arfiles = Array()
cnt = 0

sFolder = "C:\myTest"
ReDim arfiles(1)
If sFolder < "" Then

Set Folder = FSO.GetFolder(sFolder)
For Each fldr In Folder.Subfolders
ReDim Preserve arfiles(cnt)
arfiles(cnt) = fldr.Path
cnt = cnt + 1
Next

Worksheets.Add.Name = "Folders"
With ActiveSheet
For i = LBound(arfiles) To UBound(arfiles)
.Cells(i + 1, 1) = arfiles(i)
Next
.Columns("A:Z").EntireColumn.AutoFit
End With
End If

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"aking1987" wrote in message
...

Works great, except it comes back with subfolders...

3 Folders named EG1, EG2, and EG3, site in location...

X:/EXAMPLE/EXAMPLE/

there are furthur subfolders within eg1, eg2, and eg3.

how can i adjust this so the ONLY list that is displayed on the
worksheet is the original folder names... EG1, EG2, EG3

(obviously EG1,2,3 will change)

Is it possible to mask the location too?

As in all that shows in the sheet (folders) will be EG1,EG2, and
EG3...

no p:/EXAMPLE/EXAMPLE/

MANY THANKS AGAIN!

Antonio


--
aking1987
------------------------------------------------------------------------
aking1987's Profile:

http://www.excelforum.com/member.php...o&userid=15393
View this thread: http://www.excelforum.com/showthread...hreadid=313753



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
converting email address names in a range of cells to real names John Excel Worksheet Functions 1 May 19th 10 03:44 PM
Aquiring data from one sheet to another sheet in the same workbook No News Excel Worksheet Functions 10 August 1st 06 08:01 AM
to convert all the file names in one directory to .xls? S.G.Pillai Excel Discussion (Misc queries) 2 September 27th 05 05:13 PM
Aquiring Directory names aking1987[_6_] Excel Programming 1 November 16th 04 01:45 PM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM


All times are GMT +1. The time now is 06:24 AM.

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

About Us

"It's about Microsoft Excel"