>That won't work unless the result of GETFILE() is an Excel template.
How much money are you willing to bet.........and lose.... The fact is, if you specify and XLS file, it works just file......as well as an XLT...
And obviously, there are some error trapping issues the user will need to deal with...
Sorry...
>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().