Select an open excel-sheet

Post Reply
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Select an open excel-sheet

Post 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
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
joseluisysturiz
Posts: 2024
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: Select an open excel-sheet

Post 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:
Dios no está muerto...

Gracias a mi Dios ante todo!
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Select an open excel-sheet

Post by Marc Vanzegbroeck »

Thank you,

I will try it.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
hmpaquito
Posts: 1200
Joined: Thu Oct 30, 2008 2:37 pm

Re: Select an open excel-sheet

Post by hmpaquito »

Code: Select all

oSheet:= oExcel:WorkSheets(<cNameSheet>)  
Last edited by hmpaquito on Wed Oct 17, 2018 7:25 am, edited 1 time in total.
User avatar
joseluisysturiz
Posts: 2024
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: Select an open excel-sheet

Post by joseluisysturiz »

hmpaquito wrote:

Code: Select all

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

Gracias a mi Dios ante todo!
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Select an open excel-sheet

Post 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
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
hmpaquito
Posts: 1200
Joined: Thu Oct 30, 2008 2:37 pm

Re: Select an open excel-sheet

Post 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
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Select an open excel-sheet

Post 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')
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: Select an open excel-sheet

Post by Armando »

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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Select an open excel-sheet

Post by Enrico Maria Giordano »

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

EMG
Jack
Posts: 249
Joined: Wed Jul 11, 2007 11:06 am

Re: Select an open excel-sheet

Post 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 .
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Select an open excel-sheet

Post by nageswaragunupudi »

Code: Select all

   oExcel   := ExcelObj()

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

G. N. Rao.
Hyderabad, India
Jack
Posts: 249
Joined: Wed Jul 11, 2007 11:06 am

Re: Select an open excel-sheet

Post by Jack »

Greet , perfect,
Philippe
Post Reply