ID: 71
Viewed: 3170
Added: Jan 31, 2002
Version:
Snippet uploaded by: peet
Written By: peet
Demo: Sorry, no demo
Thank you for your vote. Please wait...
It appears you already voted for this snippet
It appears your vote value was empty
Function that checks if a file contains any data.
If file doesnt exist, it also returns false.
If file doesnt exist, it also returns false.
Highlight all by clicking in box
<!---Declaration--->
none
Highlight All
<!---Code--->
Private Function FileContainsData(sFileName As String) As Boolean
Dim s As String
If Dir(sFileName, vbHidden + vbReadOnly + vbSystem) <> "" Then
Open sFileName For Binary As #1
s = Input(LOF(1), 1)
Close #1
If Len(s) Then
FileContainsData = True
Else
FileContainsData = False
End If
Else
FileContainsData = False
End If
End Function
'usage
Private Sub Command1_Click()
MsgBox FileContainsData("C:Autoexec.bat")
End Sub;
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.