Page 1 of 1

Select an open excel-sheet

Posted: Tue Oct 16, 2018 4:54 pm
by Marc Vanzegbroeck
Hi,

I know how to create,open, edit and save an excel-sheet.
But is it possible to select a sheet that is already open?
I want to press a button, and than select the excell-sheet (in case if more than 1 sheet is open) that the program have to modify/use.

Thanks

Re: Select an open excel-sheet

Posted: Tue Oct 16, 2018 5:23 pm
by joseluisysturiz
Marc Vanzegbroeck wrote:Hi,

I know how to create,open, edit and save an excel-sheet.
But is it possible to select a sheet that is already open?
I want to press a button, and than select the excell-sheet (in case if more than 1 sheet is open) that the program have to modify/use.

Thanks
Intenta asi...

oHoja := oExcel:ActiveSheet() // SINO ESPECIFICAS QUE HOJA, TOMARA POR DEFECTO LA HOJA1

oExAngu:Sheets("COLUMNAS"):Select() // SELECCIONO Y ME CAMBIO A LA HOJA(pestaña) COLUMNAS Q VOY A LEER
oHoja := oExAngu:ActiveSheet() // ACTIVO HOJA SELECCIONADA, SINO ESPECIFICAS QUE HOJA, TOMARA POR DEFECTO LA HOJA1
oHoja:Cells(2, 4):Select() // POSICIONA EL CURSO EN LA CELDA ESPECIFICADA(D8) PARA LEER COLUMNA( row, col / fila, col)

saludos, gracias... :shock:

Re: Select an open excel-sheet

Posted: Tue Oct 16, 2018 5:37 pm
by Marc Vanzegbroeck
Thank you,

I will try it.

Re: Select an open excel-sheet

Posted: Tue Oct 16, 2018 5:40 pm
by hmpaquito

Code: Select all

oSheet:= oExcel:WorkSheets(<cNameSheet>)  

Re: Select an open excel-sheet

Posted: Wed Oct 17, 2018 1:31 am
by joseluisysturiz
hmpaquito wrote:

Code: Select all

oSheet:= oExcel:WorkSheets(<cNameSheet>)   // Now oSheet == oExcel:ActiveSheet()
Gracias por la informacion, saludos... :shock:

Re: Select an open excel-sheet

Posted: Wed Oct 17, 2018 6:45 am
by Marc Vanzegbroeck
Hello,

I didn't get it to work.
Maybe my question was not really clear.

What I want to do is:
- Press a button in my programm
- The program wait till I select the sheet of the excellbook that I want to use (because more than 1 excell-books can be open)
- After selecting the sheet I want to use, the program use that sheet, and get the information of that sheet

Re: Select an open excel-sheet

Posted: Wed Oct 17, 2018 7:21 am
by hmpaquito
What I want to do is:
- Press a button in my programm
ok !

The program wait till I select the sheet of the excellbook that I want to use (because more than 1 excell-books can be open)
Make it in programm shown buttons labeled with sheet names.

After selecting the sheet I want to use, the program use that sheet, and get the information of that sheet
oSheet:= oExcel:WorkSheets(cSheetSelectedFromButton)

regards

Re: Select an open excel-sheet

Posted: Wed Oct 17, 2018 8:45 am
by Marc Vanzegbroeck
Hello,

I tested it with

Code: Select all

 oExcel = CREATEOBJECT( "Excel.Application" )
oSheet:= oExcel:WorkSheets('MYPAGE')
 
but I get an error
  • Error description: Error Excel.Application/16389 E_FAIL: WORKSHEETS
    Args:
    [ 1] = C MYPAGE
on the line with oSheet:= oExcel:WorkSheets('MYPAGE')

Re: Select an open excel-sheet

Posted: Wed Oct 17, 2018 9:07 am
by Enrico Maria Giordano
Try this:

Code: Select all

oSheet = oExcel:Sheets( "MySheet" )
EMG

Re: Select an open excel-sheet

Posted: Wed Oct 17, 2018 3:08 pm
by Armando
Friends:

It looks like we can use numbers too.

oSheet = oExcel:Sheets(2)

Regards

Re: Select an open excel-sheet

Posted: Wed Oct 17, 2018 5:03 pm
by Enrico Maria Giordano
Yes, of course. Items of Microsoft collections like Sheets can be accessed by position number or string key.

EMG

Re: Select an open excel-sheet

Posted: Thu Oct 18, 2018 11:39 am
by Jack
Hi,
If the excel sheet is open by the user.
How is it possible to get the contents for the current active cell with fivewin .
How to know the x,y coord of the cell in the sheet .
Thanks .

Re: Select an open excel-sheet

Posted: Thu Oct 18, 2018 1:14 pm
by nageswaragunupudi

Code: Select all

   oExcel   := ExcelObj()

   oCell    := oExcel:ActiveCell
   if oCell != nil
      ? oCell:Value
      ? oCell:Address
      ? oCell:Row
      ? oCell:Column
   endif
 

Re: Select an open excel-sheet

Posted: Thu Oct 18, 2018 2:07 pm
by Jack
Greet , perfect,
Philippe