Ver Mensaje Individual
  #1  
Antiguo 16-09-2014
Avatar de lbidi
lbidi lbidi is offline
Miembro
 
Registrado: oct 2003
Ubicación: Montevideo- URUGUAY
Posts: 417
Reputación: 21
lbidi Va por buen camino
Problema leyendo planilla excel

Estimados.

Estoy intentando leer una planilla excel que tiene varias hojas de las cuales solo necesito los datos de una sola hoja.

He sacado el siguente codigo de un post anterior:
Código Delphi [-]
const
  xlCellTypeLastCell = $0000000B;
var
 Filename : string;
 Excel, Sheet: OLEVariant;
 CantRow, CantCol, i, j : Integer;
 RangoMatriz: Variant;
begin

  OpenDialog.Execute();

  FileName := OpenDialog.FileName;
  Excel := ComObj.CreateOleObject('Excel.Application');
  Excel.Workbooks.Open(FileName);

  Sheet := Excel.Workbooks[ExtractFileName(FileName)].WorkSheets[1];
  Sheet.Cells.SpecialCells(xlCellTypeLastCell, EmptyParam).Activate; <----- error

  Excel.Workbook.Worksheets['LISTA']; <------- Hoja que me interesa
  CantRow := Excel.ActiveCell.Row;
  CantCol := Excel.ActiveCell.Column;

Me da error cuando intenta activar, dicha linea es necesaria ??

Desde ya se agradecen las sugerencias.

Saludos
Responder Con Cita