Show file size dynamically (Excel 2007)
Just for ideas -
'' normal module
Function mySize() As String
Dim nSize As Long
nSize = FileLen(ThisWorkbook.FullName)
mySize = Format(nSize / 1024, "#,##0Kb")
End Function
Sub mySizeToSbar()
Application.StatusBar = "FileSize when last saved: " & mySize
End Sub
'' Thisworkbook module
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Application.OnTime Now, "mySizeToSbar"
End Sub
Private Sub Workbook_Deactivate()
Application.StatusBar = False
End Sub
Private Sub Workbook_Open()
mySizeToSbar
End Sub
'''' end THisworkbook
you could use this as a UDF in a cell -
=mySize()
Regards,
Peter T
"Nathan Berton" wrote in message
...
I'm using Excel 2007 and would like to show the active workbook's file
size somewhere on the UI, dynamically updated when the file is saved,
opened, activated, etc. I have a custom ribbon tab, but I don't think
you can show any sort of dynamic label on there, unless I"m mistaken.
I don't want it to be a button you click and have a msgbox pop up or
that sort of thing.
What method should I be pursuing here? I can't find any sort of way to
show this on the status bar, QAT, a custom ribbon tab, etc.
Thanks for your help!
|