Need to generate a msgbox telling how large the file is
Cresate a reference (tools references) to the Micrsoft scripting runtime
library
and then place the following in the workbook open event procedu
Dim fso As New FileSystemObject
Dim fil As File
Dim dblSize As Double
Set fil = fso.GetFolder(ThisWorkbook.Path).Files(ThisWorkboo k.Name)
dblSize = fil.Size / 1000000
If dblSize 30 Then
MsgBox "This file is " & fil.Size / 1000000 & "MB"
End If
Set fso = Nothing
Set fil = Nothing
"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
|