Function File Names Class

RandomFilePrefix

Returns eight random characters which are all valid within DOS file names. Useful for generating random DOS- and Windows-compatible file names.

Signature (Visual Basic / VBA)

Public Function RandomFilePrefix( _
    ) As String

Code Example

    Rnd(-1) = 0.224007
    RandomFilePrefix = "~}Y^Z3&U"
    RandomFilePrefix = "~}Y`WZ%8"

Notes & Version History

Note The call to the Visual Basic Rnd function in the above example seeds the Visual Basic random number generator so that the sample results can be reproduced. There is generally no need to call the Rnd function within your programs since Entisoft Tools initializes the Visual Basic random number generator once with "Randomize" statement.
Warning This function is limited to using DOS-compatible file name characters in order to retain compatibility with DOS, Windows 3.0, and Windows 3.1. Consider using the RandomString function to generate a random file prefix if a different alphabet is required.