FoxPro ForceExt() function

The vFP ForceExt() function returns the filename with the specified extension replacing any existing extension.

For example:

ForceExt ("C:\Microsoft Visual FoxPro 9\vfp9.exe", "bak")

would return

"C:\Microsoft Visual FoxPro 9\vfp9.bak"

Note that you must not include the period in the required extension. FoxPro does not check for the validity of the name that is generated and will return a filename with a double period.

VBA equivalent

Microsoft Access does not have equivalents to these FoxPro file name commands so I wrote this library Visual Basic functions to do give me the same facilities in VBA.