Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to be able to list the subfolders in any specified folder with
their respective sizes. In a search for a solution I copied this section from the VBA's help, but this is not a standalone bit of code (why do they not use standalone code for their examples?) Sub ShowFolderList(folderspec) Dim fs, f, f1, fc, s Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFolder(folderspec) Set fc = f.SubFolders For Each f1 In fc s = s & f1.Name & " " & f1.Size 'I added the "Size" bit s = s & vbCrLf Next MsgBox s So I wrote this bit to call the above code Sub test3() folderspec = "C:\" ShowFolderList (folderspec) End Sub However the line containing "Scripting.FileSystemObject" creates an error "Runtime error 429 - ActiveX component can't create object" What should folderspec be? How do I get it to work? My VBA is self taught and I come unstuck when the help talks about SearchFolders and ScopeFolders! Thanks Laurence |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Please help to list folders and subfolders tree in Excel or Word | Excel Discussion (Misc queries) | |||
Checking for subfolders and creating | Excel Worksheet Functions | |||
Map/List of folders, subfolders & files | Excel Programming | |||
Creating folders and subfolders from excel file list | Excel Discussion (Misc queries) | |||
Get list of subfolders | Excel Programming |