I would strongly recommend not to make the oExcel, oBook and oSheet PUBLIC memvars, let alone use implicit declaration of the m.I and m.X memvars, colelague Endhey! Especially since you do not RELEASE either of them at the end of your code (and do not even use that m.X after assigning the Int value to it).
I would declare all the memvars for the Excel's objects, as well as the counter m.I memvar, as LOCALs... and, BTW, I'd close/exit those Excel objects at the end, too. [;-)]
Regards,
Ilya