While lOffSet < lFileSize 'bEndOfData will be true if the current offset + CHUNKSIZE exceeds the end of the file. lBytesRead = xHash.ReadFile("c:\temp\source.txt", lOffSet, CHUNKSIZE, efpHash, _ (lOffSet + CHUNKSIZE >= lFileSize))
lOffSet = lOffSet + lBytesRead Wend
If Err.Number = 0 Then MsgBox "Finished Hashing file to memory." vaHash = xHash.HashingMethod.HashValue ' Do something with the hash value... Else MsgBox Err.Number & " " & Err.Description End If