Not a Member Yet,
Click here to Register

ID: 71
Viewed: 3091
Added: Jan 31, 2002
Snippet uploaded by: peet
Written By: peet
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

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.

Highlight all by clicking in box

Highlight All
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
FileContainsData = False
End If
FileContainsData = False
End If
End Function

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.

Replying to a Comment...

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.

© 2002 - 2022 All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!