Shellexecute problem.

Shellexecute problem.

Postby hag » Sat Oct 25, 2008 5:30 pm

Trying to open a prn file in excel using the following code.

Code: Select all  Expand view
local cfile   := ":\"   
local cName   := Curdir()      
local cDri    := curDrive()   

cFile := cDri+cFile+cName      

ShellExecute( 0,"Open","Excel", "BSfile.prn","cFile",9)


The BSfile.prn is created in my program.

It opens two Excel files.
1 is OK but opens a second copy in read only.

How to fix and get one working.

Thanks in advance.

Harvey
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby Rick Lipkin » Sat Oct 25, 2008 6:59 pm

Harvy

Try this .. let the local machine figure out what to open the file with .. if it is an .xls .. Excel will be launched ..

Code: Select all  Expand view
SHELLEXECUTE( "", "open", cFILE ,"","",1)


Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby hag » Sat Oct 25, 2008 7:26 pm

Thanks for the quick response.

The file I create is a .prn file not an xls. Need to tell what to open it with.
I did this
Code: Select all  Expand view
shellexecute("","excel",myfile," ",1)
 


Still got two copies.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby Rick Lipkin » Sat Oct 25, 2008 7:49 pm

Harvy

you might want to try WaitRun .. here is an example I use for Notepad :

Code: Select all  Expand view
WAITRUN( "NOTEPAD " +cFILENAME, 1 )


It assumes Notepad is in the 'path' to run ..

RIck Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby hag » Sat Oct 25, 2008 9:42 pm

Problem solved.

After reviewing your suggestions, nothing worked. i went through the code and found it was a redundantcy in my code. My fault. :oops:
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 75 guests