As others have pointed out, this won't work with the VFP runtime, as the compiled program is needed for execution, and VFP runtime won't compile. What might work (I'm still pretty new at all this and maybe there's some limitation that I'm not aware of) would be to assign each generated line of code to a memory variable (or element of an array memory variable) and use macro substitution to execute each line of code. (I've done this to execute variable SQL statements that are constructed on the fly based upon users' entries into a form.) I would be interested in hearing from (more experienced) others whether this would be a viable approach in your case.
>Is it possible to run a .PRG file from within a VFP executable? I have an EXE that creates a .PRG and attempts to run it, but it keeps coming up with a 'File does not exist' error. The .PRG file does exist in the current directory. This all works fine from the IDE.
"Ignorance more frequently begets confidence than does knowledge."
-- Charles Darwin
"I am invincible! Invincible...OWWWWWWWW!"
-- Homer Simpson