Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help: reference info from master spreadsheet to individual forms | Excel Worksheet Functions | |||
Writing functions to prompt for info | Excel Worksheet Functions | |||
Getting info from individual sheets into master sheet | Excel Worksheet Functions | |||
Getting info from individual sheets into master sheet | Excel Discussion (Misc queries) | |||
reporting directory info into a spreadsheet | Excel Programming |