Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to start Excel with a speific file in VFP?
Message
De
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:
00353393
Vues:
17
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform