Bir dosyanın boyutunu FileLen metodu aracılığıyla mesaj olarak gösteren VBA kodudur.
Option Explicit
Sub DosyaBoyutunuByteCinsindenOgren()
MsgBox FileLen("D:\raporlar.xlsx")
End Sub
Sub DosyaBoyutunuMegaByteCinsindenOgren()
Dim dosya As String
Dim dosyaBoyutu As Double
dosya = "C:\Windows\explorer.exe"
dosyaBoyutu = Math.Round((FileLen(dosya) / 1024 ^ 2), 3)
MsgBox dosyaBoyutu & " MB"
End Sub