![]() |
DElphi<>Excel ??
hallo,
ist das möglich ?? ich möchte auf einen wert im excel zugreifen, wenn der wert in der zelle im excell größer als 85 ist sollte in meinen delphiprogramm eine ampel auf grün schalten !!! geht das und wie ??? mfg vader |
Re: DElphi<>Excel ??
HI!
Jepp, das geht. Such mal nach den Server-Komponenten bzw. OLE-Automation. Such auch mal im Forum nach Excel. Ciao Frederic |
Re: DElphi<>Excel ??
hallo,
hab mich einmal in der suche schlaugemacht über excel und oleserver, hab da ein beispiel gefunden das genau das wäre was ich suche, aber wenn ich das prog kompilieren will kommt die fehlermeldung beim code öffnen der exceldatei ??
Delphi-Quellcode:
procedure TForm1.btnOpenFileClick(Sender: TObject);
var FExcelFilename : OleVariant; begin FExcelFilename:=ExtractFilePath(ParamStr(0))+'Quelle.xls'; ExcelApplication.Workbooks.Open(FExcelFilename,EmptyParam,EmptyParam,EmptyParam, EmptyParam,EmptyParam,EmptyParam,EmptyParam, EmptyParam,EmptyParam,EmptyParam,EmptyParam, EmptyParam,FLCID); ExcelWorkbook.ConnectTo(ExcelApplication.Workbooks.Item['Quelle.xls']); ExcelWorksheet.ConnectTo(ExcelWorkbook.Sheets.Item['Tabelle1'] as _WorkSheet); btnReadCell.Enabled:=True; end;
Delphi-Quellcode:
[Warnung] Unit1.pas(93): Symbol 'Range' ist plattformspezifisch
[Fehler] Unit1.pas(104): Undefinierter Bezeichner: 'EmptyParam' [Fataler Fehler] Project1.dpr(5): Verwendete Unit 'Unit1.pas' kann nicht compiliert werden mfg vader |
Re: DElphi<>Excel ??
Hi!
Hast du Variants in den Uses stehen? Ciao Frederic |
Re: DElphi<>Excel ??
hallo,
das vorherige problem hab ich schon gelöst, aber es gibt ein neues und zwar wenn ich diese exceldatei öffnen will c:\test.xls kommt die fehlermeldung: kann diese datei nicht finden, überprüfen sie die rechtschreibung und speicherort
Delphi-Quellcode:
mfg
procedure TForm1.btnOpenFileClick(Sender: TObject);
var FExcelFilename : OleVariant; begin FExcelFilename:=ExtractFilePath(ParamStr(0))+'c:\test.xls'; ExcelApplication.Workbooks.Open(FExcelFilename,EmptyParam,EmptyParam,EmptyParam, EmptyParam,EmptyParam,EmptyParam,EmptyParam, EmptyParam,EmptyParam,EmptyParam,EmptyParam, EmptyParam,FLCID); ExcelWorkbook.ConnectTo(ExcelApplication.Workbooks.Item['c:\test.xls']); ExcelWorksheet.ConnectTo(ExcelWorkbook.Sheets.Item['Tabelle1'] as _WorkSheet); btnReadCell.Enabled:=True; end; |
Re: DElphi<>Excel ??
Hi!
Dann sage Delphi auch, dass du diese Datei öffnen willst. Bei dir steht im Moment 'PfadzurAnwendungc:\test.xls' Diese Datei gibt es wohl nicht ==> Lass den Teil mit ExtractFilePath(paramstr(0)) weg Ciao Frederic |
Re: DElphi<>Excel ??
Hallo!
Das Problem mit der nicht auffindbaren Testdatei liegt wohl hieran: Beschreibung (aus der Delphi-Hilfe!) ParamStr gibt den in Index angegebenen Kommandozeilenparameter zurück. Ist der Wert von Index größer als ParamCount, wird ein leerer String zurückgegeben. Wird beispielsweise für Index der Wert 2 angegeben, liefert ParamStr den zweiten Parameter zurück. Unter Windows gibt ParamStr(0) den Pfad und den Dateinamen des ausgeführten Programms zurück (z.B. C:\TEST\MYPROG.EXE). Wenn du über ExtractFilePath den Pfad herausfilterst, darfst du nur noch den Dateinamen hinzufügen! Gruß Fafnir |
Re: DElphi<>Excel ??
wie muß ich das abändern das ich auch auf einen anderen speicherort eine
exceldatei öffnen kann zb. c:\ alle.xls?
Delphi-Quellcode:
procedure TForm1.btnOpenFileClick(Sender: TObject);
var FExcelFilename : OleVariant; begin FExcelFilename:=ExtractFilePath(ParamStr(0))+'alle.xls'; ExcelApplication.Workbooks.Open(FExcelFilename,EmptyParam,EmptyParam,EmptyParam, EmptyParam,EmptyParam,EmptyParam,EmptyParam, EmptyParam,EmptyParam,EmptyParam,EmptyParam, EmptyParam,FLCID); ExcelWorkbook.ConnectTo(ExcelApplication.Workbooks.Item['alle.xls']); ExcelWorksheet.ConnectTo(ExcelWorkbook.Sheets.Item['Tabelle1'] as _WorkSheet); btnReadCell.Enabled:=True; end; mfg vader [edit=alcaeus]Delphi-Tags eingefuegt. In Zukunft bitte selbst machen. Danke :) Mfg, alcaeus[/edit] |
Re: DElphi<>Excel ??
Hi!
Ich habe doch oben geschrieben, was du weglassen sollst:
Delphi-Quellcode:
Ciao Frederic
FExcelFilename:='c:\alle.xls';
|
Re: DElphi<>Excel ??
Herzlichen Dank für Deine Hilfe, jetzt funzt's
mfg vader |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:51 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz