Select an open excel-sheet

Select an open excel-sheet

Postby Marc Vanzegbroeck » Tue Oct 16, 2018 4: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Select an open excel-sheet

Postby joseluisysturiz » Tue Oct 16, 2018 5: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... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Select an open excel-sheet

Postby Marc Vanzegbroeck » Tue Oct 16, 2018 5:37 pm

Thank you,

I will try it.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Select an open excel-sheet

Postby hmpaquito » Tue Oct 16, 2018 5:40 pm

Code: Select all  Expand view
oSheet:= oExcel:WorkSheets(<cNameSheet>)  
Last edited by hmpaquito on Wed Oct 17, 2018 7:25 am, edited 1 time in total.
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Select an open excel-sheet

Postby joseluisysturiz » Wed Oct 17, 2018 1:31 am

hmpaquito wrote:
Code: Select all  Expand view
oSheet:= oExcel:WorkSheets(<cNameSheet>)   // Now oSheet == oExcel:ActiveSheet()


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

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Select an open excel-sheet

Postby Marc Vanzegbroeck » Wed Oct 17, 2018 6: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Select an open excel-sheet

Postby hmpaquito » Wed Oct 17, 2018 7: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
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Select an open excel-sheet

Postby Marc Vanzegbroeck » Wed Oct 17, 2018 8:45 am

Hello,

I tested it with
Code: Select all  Expand view
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')
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Select an open excel-sheet

Postby Enrico Maria Giordano » Wed Oct 17, 2018 9:07 am

Try this:

Code: Select all  Expand view
oSheet = oExcel:Sheets( "MySheet" )


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Select an open excel-sheet

Postby Armando » Wed Oct 17, 2018 3: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
User avatar
Armando
 
Posts: 3201
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Select an open excel-sheet

Postby Enrico Maria Giordano » Wed Oct 17, 2018 5:03 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Select an open excel-sheet

Postby Jack » 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 .
Jack
 
Posts: 288
Joined: Wed Jul 11, 2007 11:06 am

Re: Select an open excel-sheet

Postby nageswaragunupudi » Thu Oct 18, 2018 1:14 pm

Code: Select all  Expand view
  oExcel   := ExcelObj()

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Select an open excel-sheet

Postby Jack » Thu Oct 18, 2018 2:07 pm

Greet , perfect,
Philippe
Jack
 
Posts: 288
Joined: Wed Jul 11, 2007 11:06 am


Return to FiveWin for Harbour/xHarbour

Who is online

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