Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 To: Riccardo Pimpini
  Where is Riccardo Pimpini?
 Firenze
 Italy
 Riccardo Pimpini
 Tags
Subject: RE: call Excel from VFP
Thread ID: 248784 Message ID: 248814 # Views: 3 # Ratings: 4
Version: Visual FoxPro 9 SP2 Category: Microsoft Office Automation
Date: Wednesday, December 23, 2009 3:40:39 PM         
   


> Hi All again,
> I have to run an external application from a click event of a button with some parameters passed by command line...
>
> I explain mayself...
>
> run Excel exe passing it a string with the file to open
>
> someting like:
>
>
RUN <path>\excel.exe "cartel.xls" 

>
> but this actually doesent work...
>
> Is there a correct function in VFP?
>
> I know that you have probably already talked about this problem but i can't find the references..
> you can also sen some links thanks...
>
>
> Shinedom - Shining is free....

While the issue has been solved, I would still suggest you to use this:

#define SW_SHOWNORMAL       1
declare long ShellExecute in "shell32.dll" ;
	long hwnd, string lpszOp, ;
	string lpszFile, string lpszParams, ;
    string lpszDir, long nShowCmd

ShellExecute(0,'Open',FULLPATH('cartel.xls'),0,0,SW_SHOWNORMAL)


Reason(s):
-Your ole automation was failing because Excel doesn't know the path to 'Cartel.xls' and thus is trying to display an error.
-ShellExecute is like the run command. However you only need the full path and file name of the file you would open ( fullpath('cartel.xls') ). System chooses how to open it (IOW same as if you double clicked an XLS in windows explorer).

Cetin Basoz

.Net has got better.Think about moving - check my blog:
Blog (main)
Blog (mirror)

ENTIRE THREAD

call Excel from VFP Posted by Riccardo Pimpini @ 12/23/2009 11:09:30 AM
RE: call Excel from VFP Posted by ho me @ 12/23/2009 11:15:39 AM
RE: call Excel from VFP Posted by Riccardo Pimpini @ 12/23/2009 11:31:44 AM
RE: call Excel from VFP Posted by M. Akram Bhatti @ 12/23/2009 11:36:59 AM
RE: call Excel from VFP Posted by Riccardo Pimpini @ 12/23/2009 12:06:32 PM
RE: call Excel from VFP Posted by M. Akram Bhatti @ 12/23/2009 12:11:58 PM
RE: call Excel from VFP Posted by Anders Altberg @ 12/23/2009 12:31:54 PM
RE: call Excel from VFP Posted by Stefan Wuebbe @ 12/23/2009 4:12:52 PM
RE: call Excel from VFP Posted by M. Akram Bhatti @ 12/23/2009 12:00:10 PM
RE: call Excel from VFP Posted by Stefan Wuebbe @ 12/23/2009 12:05:21 PM
RE: call Excel from VFP Posted by Riccardo Pimpini @ 12/23/2009 12:18:24 PM
RE: call Excel from VFP Posted by tushar @ 12/23/2009 1:11:17 PM
RE: call Excel from VFP Posted by Riccardo Pimpini @ 12/23/2009 2:08:23 PM
RE: call Excel from VFP Posted by tushar @ 12/23/2009 3:27:06 PM
RE: call Excel from VFP Posted by Stefan Wuebbe @ 12/23/2009 4:18:01 PM
RE: call Excel from VFP Posted by Stefan Wuebbe @ 12/23/2009 4:43:31 PM
RE: call Excel from VFP Posted by Cetin Basoz @ 12/23/2009 3:40:39 PM