Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
MDW
 
Posts: n/a
Default Function To Dynamically Display File Size

I need a function that will dynamically calculate the current workbook's size
(either in KB of MB) and display it. I wrote the following wrapper function:

Public Function FileSize() As Long

FileSize = FileLen(ActiveWorkbook.Path & "\" & ActiveWorkbook.Name)

End Function

It works, except that if you add or remove any data, you have to save,
close, and re-open the file for the new size to display. Are there any
options that will show the file size after it is saved?

Thanks.

--
Hmm...they have the Internet on COMPUTERS now!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Function To Dynamically Display File Size

I didn't have to close and reopen, but I did have to recalculate the workbook.

Just adding:

application.volatile

To the top of your sub would make that your UDF would recalc whenever excel
did. (You could be one calculation behind.)

And the workbook has to be saved--since you're asking for the filesize and that
doesn't really exist until it's a file.



MDW wrote:

I need a function that will dynamically calculate the current workbook's size
(either in KB of MB) and display it. I wrote the following wrapper function:

Public Function FileSize() As Long

FileSize = FileLen(ActiveWorkbook.Path & "\" & ActiveWorkbook.Name)

End Function

It works, except that if you add or remove any data, you have to save,
close, and re-open the file for the new size to display. Are there any
options that will show the file size after it is saved?

Thanks.

--
Hmm...they have the Internet on COMPUTERS now!


--

Dave Peterson
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
VLOOKUP blows up file size BlueTill Excel Worksheet Functions 0 July 14th 05 01:54 PM
Size (mb) of sheets in file EstherJ Excel Discussion (Misc queries) 1 April 15th 05 06:27 PM
Importing .txt data files increases .xls file size BrianJ Excel Discussion (Misc queries) 1 January 29th 05 02:02 PM
File size increase Bill Clark Excel Discussion (Misc queries) 1 January 28th 05 06:57 PM
Macro or Function to make text size to suite text Length? lbbss Excel Discussion (Misc queries) 4 December 14th 04 07:53 PM


All times are GMT +1. The time now is 04:41 PM.

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"