Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
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
Are Protection Options Compatible? Reitanos Excel Worksheet Functions 3 January 5th 09 09:28 PM
VBA 2003 and XP compatible? iamito Excel Programming 4 August 23rd 07 01:10 PM
Compatible with Office 97 Pete[_4_] Excel Programming 4 May 15th 05 08:35 PM
UDF 2000 compatible? Bob Phillips[_6_] Excel Programming 1 January 22nd 04 09:11 PM
UDF 2000 compatible? Niek Otten Excel Programming 0 January 22nd 04 08:38 PM


All times are GMT +1. The time now is 02:06 PM.

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"