That won't work unless the result of GETFILE() is an Excel template. Worse yet, if the user cancels out of GETFILE(), it will have the same result as not seleting a template and create a new default workbook.
The simple answer to all of this is:
oExcel=CREATEOBJECT("Excel.Application")
cExcelFile=GETFILE("XLS")
IF !EMPTY(cExcelFile)
oWorkBook=oExcel.Workbooks.Open(cExcelFile)
ELSE
WAIT WIND "No file selected!"
ENDIF
>There are several methods... You have already been shown how to use the ShellExecute function of the Windows API.
>
>However, if you need to interact with Excel, you will want to use automation:
>
>oExcel = Createobject("excel.application")
>oworkbook = oExcel.workbooks.add(Getfile()) && point to an xls file....
>oExcel.visible = .t.
>
>
>>I want to click a buttom to lunch Excel with a excel document which a get from getfile().
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05