View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Get File Size (Number of Bytes) of Active Workbook

Firstly,

it is not a good idea to use the index, you cannot rely on it always being
the same, better to use the property name. But in this case it seems to make
no difference.

Some of the properties apply to some products, n umber of slides is clearly
PowerPoint, so maybe Number of Bytes does not apply to Excel.

--
HTH

Bob Phillips

"dflayfield" wrote in message
...
I need to populate a cell with the current file size of the active

workbook.
I have tried:

Function FileSize(I As Integer)
FileSize = ThisWorkbook.BuiltinDocumentProperties(I)
End Function

and called the function in the sheet with:
=FileSize(22) ' 22 being the code for "Number of Bytes"
I get a #VALUE! error.

But if I use:
=FileSize(3) '3 being the code for "Author"
it works properly.

Any ideas?

Thanks,
Dave