Wheras calling Excel in the same way eg:- 
           WinExec('C:\MicrosoftOffice\Office\Excel.exe Sample.csv', sw_normal);
will not start Excel and automatically load the 'Sample.csv' file, and neither can I make it start in a similar fashion from the Windows Application "RUN" menu.
 
  What is so different about Excel?  I can call it from Explorer. I can even double-click on a .CSV file in explorer and start Excel
by association thus loading and displaying the file I clicked on.
 
it's not clear from your description whether the problem is that Excel
doesn't start, or that it starts but fails to open sample.csv
 
but here are some ramblings - i hope more useful than no response:
 
i tried your code above (D5 NT4.0) and it ran excel and opened the csv file.
 
I needed to fix up the path - my excel wasn't on drive C:   But also
(perhaps more importantly) I needed to change "MicrosoftOffice" to
"Microsoft Office".   It may be you need to make this change as well.
 
Try testing the return value from Winexec.   Strangely the return is 
> 31 on success, some small integer on normal failures, and 0 on
"out of memory".   "Out of memory" is Microsoft's name for lots of errors
that have nothing to do with memory or being out of it.   For example, I
tried
 
  ret:=WinExec('\\foo\Excel.exe Sample.csv', sw_normal);
 
and got back 0 for ret (the real problem being i don't have a machine on the
network named 'foo')
 
If I don't change MicrosoftOffice to Microsoft Office I get back a
ERROR_FILE_NOT_FOUND (=2).  The documentation also claims a return
of ERROR_PATH_NOT_FOUND is possible but i was not ever able to induce
mine to not find a path - it always insists it is the file it can
not find.
 
Also - the csv file needed to be in my "Personal" folder - by default that
is where Excel Open goes looking for unqualified filenames.
 
Finally, if you're doing this on w2k instead of NT maybe this is a
permission issue.    2k is fussier about permissions generally
(although I can't think of what the problem would be).
 
-ns

Reply via email to