Originally Posted by
nirvana_1
Option Explicit
Sub CheckFileSize()
Dim objFS, objFile
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFile = objFS.GetFile("c:\temp\test.txt")
'Assume that the file is IDLE initially, cell A1 has value of IDLE.
'The size of the file is stored in cell A2 e.g. 1024 (in bytes)
'Check if the size is same as size in cell A2
If objFile.Size = Sheets(1).Cells(1, 2) Then
Sheets(1).Cells(1, 1).Value = "IDLE"
Else
Sheets(1).Cells(1, 1).Value = "DIFFERENT"
'Update cell A2 with new value
Sheets(1).Cells(1, 2).Value = objFile.Size
End If
End Sub