Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA compatible code - PC to Mac
Does anyone know if there is a comparable VBA function on the Mac to
Application.FileSearch.FoundFiles.Count on the PC? I'm running excel 2004 for Mac 11.5.4/VBA 11.5 Art |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA compatible code - PC to Mac
I don't have a MAC but see if this code works. if it does I will modify it
to do what you want. The code gets size of all subfolders on the c drive and put the info on a worksheet. I think for MAC's you have to change the backshalsh ("\") to a colon (":") for it to work. I also was told that on PC's for excel 2007 the filesearch was not included in excel 2007 but an update added the function. I would also try going to Microsoft.com and getting all the latest updates for excel and vista. Dim RowNumber Sub GetFolderSize() strFolder = "C:" RowNumber = 1 Set FSO = CreateObject _ ("Scripting.FileSystemObject") Set Folder = _ FSO.GetFolder(strFolder) Sheets(1).Cells(RowNumber, 1) = strFolder + "\" Sheets(1).Cells(RowNumber, 2) = Folder.Size RowNumber = RowNumber + RowNumber Call GetSubFolder(strFolder + "\") End Sub Sub GetSubFolder(strFolder) Set FSO = CreateObject _ ("Scripting.FileSystemObject") Set Folder = _ FSO.GetFolder(strFolder) If Folder.subfolders.Count 0 Then For Each sf In Folder.subfolders On Error GoTo 100 Call GetSubFolder(strFolder + sf.Name + "\") 100 Next sf End If 'folder size in bytes On Error GoTo 200 For Each fl In Folder.Files Sheets(1).Cells(RowNumber, 3) = fl.DateLastModified Sheets(1).Cells(RowNumber, 2) = fl.Size Sheets(1).Cells(RowNumber, 1) = strFolder & fl.Name RowNumber = RowNumber + 1 Next fl 200 On Error GoTo 0 End Sub "c1802362" wrote: Does anyone know if there is a comparable VBA function on the Mac to Application.FileSearch.FoundFiles.Count on the PC? I'm running excel 2004 for Mac 11.5.4/VBA 11.5 Art |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Are Protection Options Compatible? | Excel Worksheet Functions | |||
VBA 2003 and XP compatible? | Excel Programming | |||
Compatible with Office 97 | Excel Programming | |||
UDF 2000 compatible? | Excel Programming | |||
UDF 2000 compatible? | Excel Programming |