Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to start Excel with a speific file in VFP?
Message
From
31/03/2000 11:40:14
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00353059
Message ID:
00353393
Views:
16
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform