PARAMETERS strFunction, strTable >** Build the command string >cmdString = &strFunction(&strTable) >** Execute the command string >&cmdString > >DEFINE CLASS FoxUtil AS CUSTOM OLEPUBLIC > > FUNCTION MakeCustomFile(strTable) > USE &strTable SHARED > **** Do simple fox stuff here **** > RETURN "MyValue" > clear all > close all > release all > ENDFUNC > >ENDDEFINERight off the bat, you are returning from the function before your clean up code runs.