Function File Operations Class

Checksum16File

"16-bit File Checksum" Finds the 16-bit checksum of a file. The checksum is the sum of the ASCII values of all of the characters within the file. Checksum is returned as a Long (Integer) value between 0 and 65,536. Uses modulo addition so that the function will return the 16 least significant bits of the sum.

Signature (Visual Basic / VBA)

Public Function Checksum16File( _
    ByVal vFileName As Variant _
    ) As Variant

Code Example

    Assuming
       Checksum16("ABCD") = 266
       StringToFile("ABCD", "C:\Test.Out") = True
    for example
       Checksum16File("C:\Test.Out") = 266

Parameters

Parameter Description
vFileName Name of the file for which the checksum will be calculated. Function returns Null if vFileName is Null or cannot be fixed-up to a string. Function returns Null if there is any type of error, such as when the file does not exist.