Function File Operations Class

StringToFile

Write a string to the named file. The file is created if it does not already exist. Function returns True upon success and False upon failure.

Signature (Visual Basic / VBA)

Public Function StringToFile( _
      ByVal vString As Variant _
    , ByVal vFileName As Variant _
    ) As Boolean

Code Example

    StringToFile("That.", "Test.Out") = True
    FileToString("Test.Out") = "That."

Parameters

Parameter Description
vString The String that will be written to the file named vFileName. vString defaults to an empty string ("") if it is Null or cannot be fixed-up to a string.
vFileName Name to the file to which the string vString will be written. Function returns False if vFileName is Null or cannot be fixed-up to a string.

Notes & Version History

Careful Note that the order of the arguments is as implied by the function name--String then FileName.
Warning This function does NOT add any carriage return nor newline characters around the string.