Here is a function that tests specific characters of a file.

Since it is an internal function it can assume that the given file is at least long enough to hold the characters.

I specify a file handle (so we know that the file exists and is open), a string of characters to be sought, and a starting location.

The starting location is zero-origin; the first character is at seek position "0" in the file.

The starting location can be expressed either as a decimal numeric value or as a character string. If the latter, I assume it is a hexadecimal location. This means that if I am unscrambling a file using a hex portrayal like Vernon Buerg's List.COM I can offer as a direct parameter the displayed hexadecimal location in the file.

<pre>Public Function boolChar(intFile As Integer, strText As String, locStart) As Boolean
' Procedure : boolChar
' Description: Test if character of a file are present.
' Copyright: Chris Greaves Inc.
' Inputs: File handle, character string, start position in file.
' Returns: TRUE if match is made.
' Assumes: None.
' Side Effects: None.
' Tested: By the calls shown below.

Dim lngstart As Long
If IsNumeric(locStart) Then
lngstart = locStart
If VarType(locStart) = vbString Then
lngstart = lngHexToLong(locStart)
MsgBox "boolChar wrong type " & locStart
End If
End If
Dim intLength As Integer
intLength = Len(strText)
Dim strChars As String
Seek intFile, lngstart + 1
strChars = Input(intLength, intFile)
boolChar = (strChars = strText)
'Sub TESTboolChar()
'Dim intFile As Integer
'intFile = FreeFile
'Open "i:greavestrainingwordpr~1wp51Maths.w51" For Binary As intFile
'MsgBox boolChar(intFile, "WPC", 1) ' true
'MsgBox boolChar(intFile, "WPC", "01") ' true
'MsgBox boolChar(intFile, "WPC", "02") ' false
'Close intFile
'End Sub
End Function