Function File Operations Class

FileToString

Read a file, returning its contents as a String. Function returns Null upon failure.

Signature (Visual Basic / VBA)

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

Code Example

    ? StringToFile("Something.", "Debug.Tmp")
    True
    ? FileToString("Debug.Tmp")
    Something.
    ? FileToString("ZZ:!@#")
    Null

Parameters

Parameter Description
vFileName Name of the file whose contents will be returned as a String. Function returns Null if vFileName is Null or cannot be fixed-up to a String. Function also returns Null if there is an error, such as when the file does not exist or cannot be read.