Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
converting email address names in a range of cells to real names | Excel Worksheet Functions | |||
Aquiring data from one sheet to another sheet in the same workbook | Excel Worksheet Functions | |||
to convert all the file names in one directory to .xls? | Excel Discussion (Misc queries) | |||
Aquiring Directory names | Excel Programming | |||
Check if directory empty OR no of files in directory. | Excel Programming |