Hola:
No tienes necesidad de utilizar ningun componente te envio un codigo que te puede servir para la importacion:
Código:
procedure TFormMenu.Ventas2Click(Sender: TObject);
var
j: Integer;
begin
try
Excel := CreateOleObject('Excel.Application');
except
Excel.Quit;
showmessage('No se pudo crear el Objecto Excel.');
raise;
end;
if OpenDialogXls.Execute then Archivo:= OpenDialogXls.FileName
else exit;
Excel.Workbooks.Open(Archivo);
j:= 2;
repeat
with InsertarProductos do
begin
Close;
Parameters.ParamByName('@codigo').Value:= Excel.Cells[j,1].Value;
Parameters.ParamByName('@descripprod').Value:= Excel.Cells[j,2].Value;
Parameters.ParamByName('@idum').Value:= Excel.Cells[j,7].Value;
Parameters.ParamByName('@preciopub').Value:= Excel.Cells[j,3].Value;
Parameters.ParamByName('@precioemp').Value:= Excel.Cells[j,4].Value;
Parameters.ParamByName('@descom').Value:= 0;
Parameters.ParamByName('@periodo').Value:= 30;
Parameters.ParamByName('@categoria').Value:= Excel.Cells[j,8].Value;
Parameters.ParamByName('@costounitario').Value:= Excel.Cells[j,5].Value;
Parameters.ParamByName('@cup').Value:= Excel.Cells[j,6].Value;
Prepared:= True;
ExecProc;
end;
inc(j);
until Excel.Cells[j,2].Value = '';
Excel.quit;
ShowMessage(' El fichero de productos ha sido importado exitosamente');
end;
Donde debes declarar como variables locales a la Unit
Archivo: String;
Excel : Variant;
y debes poner en el uses de la Unit Excel97, ComObj
Ademas debes poner un OpenDialog en el formulario de importacion
Saludos
Luis Garcia