LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Writing directory info to individual cells

You're a champion!

Thanks for that.


Robert Mulroney wrote:
Ok well you just need to use similar code and turn it into a function. These
can be used on the worksheet like this

=filesize("c:\AUTOEXEC.BAT")

or

=folderSize("c:\windows")

'_________________________________________________ ___________

Public Function fileSize(filePath As String) As String
On Error GoTo getmeouttahere

'Create and object that can access the file system.
Set filesys = CreateObject("Scripting.FileSystemObject")
Set file = filesys.GetFile(filePath)

'Get the size of the file
fileSize = CStr(file.Size)
Exit Function

getmeouttahe
fileSize = "Cannot find File """ & filePath & """"
End Function


Public Function folderSize(path As String)
On Error GoTo getmeouttahere

'Create and object that can access the file system.
Set filesys = CreateObject("Scripting.FileSystemObject")
Set Folder_C = filesys.GetFolder(path)

'Get the size of the folder
folderSize = CStr(Folder_C.Size)

Exit Function

getmeouttahe
folderSize = "Cannot find path """ & path & """"

End Function

'_________________________________________________ ___________


- Rm



" wrote:

Well, it's more a range of files really. Like a range of files, in a
particular directory, for a given month.

For example, iis log files. Getting the size of a month's worth of log
files, then writing them to a specific cell, for multiple logs on
multiple servers.

Thanks again



 
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
Help: reference info from master spreadsheet to individual forms Tia Excel Worksheet Functions 1 March 6th 07 09:41 PM
Writing functions to prompt for info Conan Kelly Excel Worksheet Functions 1 December 28th 06 09:22 PM
Getting info from individual sheets into master sheet [email protected] Excel Worksheet Functions 4 November 21st 06 10:05 AM
Getting info from individual sheets into master sheet [email protected] Excel Discussion (Misc queries) 1 November 17th 06 05:24 PM
reporting directory info into a spreadsheet Tim[_39_] Excel Programming 3 August 6th 04 11:47 AM


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

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

About Us

"It's about Microsoft Excel"