erro ao importar do excel
boa tarde pessoal estou tentando importar uns dados do excel e jogar em uma base de dados sql server..
estou com o seguinte codigo
var caminho,DIA,MES,ANO: string;
CONT: INTEGER;
begin
case Treeview1.Selected.ImageIndex of
1:
Begin
if Opendialog.Execute then
begin
Caminho:= Opendialog.FileName;
caminho:= extractfilename(caminho);
end;
if copy(caminho,1,6) = ´EQUIPE´ THEN
Begin
MES:= EXCEL.Range[´G4´,´G4´].Value2;
ANO:= EXCEL.Range[´H4´,´H4´].Value2;
FOR CONT:=9 TO 39 DO
BEGIN
DIA := Excel.Range[´A´+IntToStr(Cont),´A´+IntToStr(Cont)].Value2;
DM.EquipeOperaSP.Value := Excel.Range[´B´+IntToStr(Cont),´B´+IntToStr(Cont)].Value2;
DM.EquipeOperaKM.Value := Excel.Range[´C´+IntToStr(Cont),´C´+IntToStr(Cont)].Value2;
DM.EquipeOperaCOORDEN.Value := Excel.Range[´D´+IntToStr(Cont),´D´+IntToStr(Cont)].Value2;
DM.EquipeOperaBANLANCEI.Value := Excel.Range[´E´+IntToStr(Cont),´E´+IntToStr(Cont)].Value2;
DM.EquipeOperaAUXPISTA1.Value := Excel.Range[´F´+IntToStr(Cont),´F´+IntToStr(Cont)].Value2;
DM.EquipeOperaAUXPISTA2.Value := Excel.Range[´G´+IntToStr(Cont),´G´+IntToStr(Cont)].Value2;
DM.EquipeOperaAGENTE.Value := Excel.Range[´H´+IntToStr(Cont),´H´+IntToStr(Cont)].Value2;
DM.EquipeOperaDATA.Value := STRTODATE(MES+´/´+DIA+´/´+ANO);
END;
end;
END;
END;
END;
sendo que excel é um excelapplication..
pesquisei outros jeitos no site mas não consegui encontrar uma solução..
se vcs puderem me ajudar ficarei grato..
valeu
estou com o seguinte codigo
var caminho,DIA,MES,ANO: string;
CONT: INTEGER;
begin
case Treeview1.Selected.ImageIndex of
1:
Begin
if Opendialog.Execute then
begin
Caminho:= Opendialog.FileName;
caminho:= extractfilename(caminho);
end;
if copy(caminho,1,6) = ´EQUIPE´ THEN
Begin
MES:= EXCEL.Range[´G4´,´G4´].Value2;
ANO:= EXCEL.Range[´H4´,´H4´].Value2;
FOR CONT:=9 TO 39 DO
BEGIN
DIA := Excel.Range[´A´+IntToStr(Cont),´A´+IntToStr(Cont)].Value2;
DM.EquipeOperaSP.Value := Excel.Range[´B´+IntToStr(Cont),´B´+IntToStr(Cont)].Value2;
DM.EquipeOperaKM.Value := Excel.Range[´C´+IntToStr(Cont),´C´+IntToStr(Cont)].Value2;
DM.EquipeOperaCOORDEN.Value := Excel.Range[´D´+IntToStr(Cont),´D´+IntToStr(Cont)].Value2;
DM.EquipeOperaBANLANCEI.Value := Excel.Range[´E´+IntToStr(Cont),´E´+IntToStr(Cont)].Value2;
DM.EquipeOperaAUXPISTA1.Value := Excel.Range[´F´+IntToStr(Cont),´F´+IntToStr(Cont)].Value2;
DM.EquipeOperaAUXPISTA2.Value := Excel.Range[´G´+IntToStr(Cont),´G´+IntToStr(Cont)].Value2;
DM.EquipeOperaAGENTE.Value := Excel.Range[´H´+IntToStr(Cont),´H´+IntToStr(Cont)].Value2;
DM.EquipeOperaDATA.Value := STRTODATE(MES+´/´+DIA+´/´+ANO);
END;
end;
END;
END;
END;
sendo que excel é um excelapplication..
pesquisei outros jeitos no site mas não consegui encontrar uma solução..
se vcs puderem me ajudar ficarei grato..
valeu
Eric.miranda
Curtidas 0
Respostas
Lucas Silva
06/07/2004
Qual a descrição do erro?
GOSTEI 0