Alaska Software Inc. - Select a excel file when there is several books opened.
Username: Password:
AuthorTopic: Select a excel file when there is several books opened.
CESAR CALVOSelect a excel file when there is several books opened.
on Mon, 07 Dec 2015 20:58:32 +0100
Hello.
How can I select a excel file in order to close it?


cFil := "D:\MIDAS\PROCESOS\FICHEROS\151027-5390005441-817.xls"

oExcel = GetObject(  cFIL,"Excel.Application" )
oBook := oExcel:workbooks: (I don´t know what is necessary here)

oBook:Save()

oBook:close(.T.)


Thanks.
César.
CESAR CALVORe: Select a excel file when there is several books opened.
on Tue, 08 Dec 2015 09:45:26 +0100
I have saw the solution.
The name of the Book must be without the root and then is with  oBook  := 
oExcel:workbooks("151027-5390005441-817.xls"):Activate
Regards.
César.

 HOJA A TRATAR

ccFIL := "D:\MIDAS\PROCESOS\FICHEROS\151027-5390005441-817.xls"

 COMPRUEBA SI LA HOJA ESTÁ ABIERTA PARA CERRARLA

nHandle := FOpen( ccFIL, FO_READWRITE )

IF FError() <> 0

   FClose( nHandle )

   oExcel = GetObject(  ccFIL,"Excel.Application" )

   oBook  := oExcel:workbooks("151027-5390005441-817.xls"):Activate


   oExcel:ActiveWorkbook:Save()

   oExcel:ActiveWorkbook:Close()

   ELSE

   FClose( nHandle )

ENDIF

"CESAR CALVO" escribió en el mensaje de 
noticias:d246fe7$72865396$9d992@news.alaska-software.com...

Hello.
How can I select a excel file in order to close it?


cFil := "D:\MIDAS\PROCESOS\FICHEROS\151027-5390005441-817.xls"

oExcel = GetObject(  cFIL,"Excel.Application" )
oBook := oExcel:workbooks: (I don´t know what is necessary here)

oBook:Save()

oBook:close(.T.)


Thanks.
César.