Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Automation ?

Status
Not open for further replies.

viettla

Programmer
Jul 19, 2002
34
VN
Hi all,
My code as below:
Public oExcelObj
oExcelObj=getObject('',Excel.Application)

Excel window disappear when I quit my app
How to retain Excel window ?
Thank for advance

Viet
 
Viet,

Are you actually doing anything with the Excel object in your app? Or is the purpose of your code simply to launch Excel?

If the latter, you can solve the problem by using ShellExecute() to launch Excel. It is also quicker.

For more information on ShellExecute(), see:

Mike


Mike Lewis
Edinburgh, Scotland
 
thank Mike
I generate a report to Excel and I don't want Excel close automaticlly when they close my app. now I'll try your link

Viet
 
Thank Mike
Your website is excellent.It gives a lot info to me but how to know path of Excel.exe in client machine , I only want to start Excel.


Viet
 
Viet,

Thanks for your kind words.

If you only want to use ShellExecute() to launch Excel, you don't need to know the path. Excel will be registered on the client systems, so Windows will know how to load it.

So your code will look something like this:

lcFile = "excel.exe"
? ShellExecute(0,"open",lcFile,"","",1)

Alternatively, if you want to open Excel with a specific workbook, you can pass the workbook name in the third paramter.

Mike


Mike Lewis
Edinburgh, Scotland
 
viettla,

If you stick with the automation approached take a look at faq184-4428 Excel - How to do Automation from VFP

There may be other examples in the faq section too.

Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top