Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to start Excel with a speific file in VFP?
Message
 
À
31/03/2000 11:40:14
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00353059
Message ID:
00353417
Vues:
21
>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().
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform