Dear Mr.Shuming Wang
Your code is working fine for me
#include "fivewin.ch"
FUNCTION MAIN
 cFile:="c:\users\anser\desktop\Test.xls"
 MsgInfo("About to create Excel object")
Â
 oExcel := TOleAuto():New( "Excel.Application" )
 oExcel:WorkBooks:Open(ALLTRIM(cfile))
 oSheet := oExcel:ActiveSheet()
Â
 MsgInfo("Open and Check Task Manager, you should find EXCEL.EXE in the Processes List")
Â
 oExcel:quit()
Â
 MsgInfo("Excel is closed. After you close this MsgBox,";
     "you will not find EXCEL.EXE in the Task Manager, Processes List")
 Â
RETURN NIL
Tested using Office 2007. It is also better to do a oWorkBook:Close() before the oExcel:Quit()
oWorkBook:=oExcel:WorkBooks:Open(ALLTRIM(cfile))
oWorkBook:Close()
oExcel:Quit()
I suggest you to check whether any previously opened Excel instances are still running in your PC, may be that could be the reason.
While trying to creating the excel object, It is always better to code as given below
TRY
  oExcel = GetActiveObject( "Excel.Application" )
CATCH
  TRY
    oExcel = CreateObject("Excel.Application")
  CATCH
    MsgInfo("It seems that Excel is not installed on this PC. You need Excel to continue further")
    Return .F.
  END
END
Regards
Anser