Posted to microsoft.public.excel.programming
|
|
Need to generate a msgbox telling how large the file is
Thanks Alex! Works perfect.
--
Robert
"Alex Simmons" wrote:
On Apr 14, 12:18 pm, robs3131
wrote:
Hi all,
I would like to like have a msgbox come up during Workbook_Open only when
the size of the file being opened exceeds a certain size (ie - 30 MB). I'm
wondering what the best way is to this - I'm at a loss on how to even begin
the coding to look for the file size.
Thanks for your help!
--
Robert
Robert,
See this post, which uses the filelen function:
http://en.allexperts.com/q/Excel-105...Excel-file.htm
So, providing the document has been saved (which it has by the sounds
of your post), then you could use something like this:
Private Sub Workbook_Open()
If FileLen(ThisWorkbook.FullName) = 31457280 Then
MsgBox ("Your prompt here")
End If
End Sub
31457280 is 30Mb in Bytes; and you can then use MsgBox to display
whatever message you want.
Regards,
Alex
|