FoxPro DefaultExt() function

The VFP DefaultExt() function returns the filename with the specified extension if it has no extension already.

For example:

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

would return

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

because the filename already has an extension.

Note that this function will assume that a filename which ends in a period does already have an extension and will not add the new extension.

If you do need to replace any existing extension then use the ForceExt function.

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.

Related Items

FoxPro file extensions

File formats and extensions used by FoxPro

Read More

Access 2007 file extensions

Access 2007 has new file extensions.

Read More