FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Select an open excel-sheet
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Select an open excel-sheet
Posted: Tue Oct 16, 2018 04:54 PM

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

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: Select an open excel-sheet
Posted: Tue Oct 16, 2018 05:23 PM
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... :-)
Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Select an open excel-sheet
Posted: Tue Oct 16, 2018 05:37 PM

Thank you,

I will try it.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Select an open excel-sheet
Posted: Tue Oct 16, 2018 05:40 PM
Code (fw): Select all Collapse
oSheet:= oExcel:WorkSheets(<cNameSheet>)
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: Select an open excel-sheet
Posted: Wed Oct 17, 2018 01:31 AM
hmpaquito wrote:
Code (fw): Select all Collapse
oSheet:= oExcel:WorkSheets(<cNameSheet>)   // Now oSheet == oExcel:ActiveSheet()


Gracias por la informacion, saludos... :-)
Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Select an open excel-sheet
Posted: Wed Oct 17, 2018 06:45 AM

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

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Select an open excel-sheet
Posted: Wed Oct 17, 2018 07:21 AM
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
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Select an open excel-sheet
Posted: Wed Oct 17, 2018 08:45 AM
Hello,

I tested it with
Code (fw): Select all Collapse
 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[/list:u]
    on the line with oSheet:= oExcel:WorkSheets('MYPAGE')
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Select an open excel-sheet
Posted: Wed Oct 17, 2018 09:07 AM
Try this:

Code (fw): Select all Collapse
oSheet = oExcel:Sheets( "MySheet" )


EMG
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Select an open excel-sheet
Posted: Wed Oct 17, 2018 03:08 PM

Friends:

It looks like we can use numbers too.

oSheet = oExcel:Sheets(2)

Regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Select an open excel-sheet
Posted: Wed Oct 17, 2018 05:03 PM

Yes, of course. Items of Microsoft collections like Sheets can be accessed by position number or string key.

EMG

Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Re: Select an open excel-sheet
Posted: Thu Oct 18, 2018 11:39 AM

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 .

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Select an open excel-sheet
Posted: Thu Oct 18, 2018 01:14 PM
Code (fw): Select all Collapse
   oExcel   := ExcelObj()

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



G. N. Rao.

Hyderabad, India
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Re: Select an open excel-sheet
Posted: Thu Oct 18, 2018 02:07 PM

Greet , perfect,
Philippe

Continue the discussion