I am using Delphi 5 and win 2000. I am trying to create graphs based on data
from an excel file. I create the excel file with my RLL and inside that RLL
I want to be able to create the excel file. Here is the code I have so far
and I can't get it to run, I keep getting OLE errors while running the
program.
chartType := xlLineMarkers;
PlotBy := xlRows;
Where := xlLocationAsNewSheet;
Name := 'Customer Joins';
with ExcelWorkbook1 do
begin
Charts.Add(before EmptyParam,
after ExcelWorkbook1.Sheets[iSheet],//EmptyParam,//
count EmptyParam,//1,
type_ EmptyParam,//chartType
LCID iLCID);
inc(iSheet);
//ExcelWorkSheet1.ConnectTo(ExcelWorkbook1.Sheets[iSheet] as
_Worksheet);
ActiveChart.ChartType := chartType;
with ActiveChart do
begin
try
SetSourceData(ExcelApplication1.Union(
ExcelWorksheet1.Range[checkColumnLetter(1)+IntToStr(iIntTotLine),
checkColumnLetter(iNumDays+2)+IntToStr(iIntTotLine)],
ExcelWorksheet1.Range[checkColumnLetter(1)+IntToStr(iExtTotLine),
checkColumnLetter(iNumDays+2)+IntToStr(iExtTotLine)],
ExcelWorksheet1.Range[checkColumnLetter(1)+IntToStr(iTotsLine),
checkColumnLetter(iNumDays+2)+IntToStr(iTotsLine)]),
PlotBy);
except
on E:Exception do
begin
Showmessage('Error in setting source data'+#13#10+
E.Message);
ExcelApplication1.Disconnect;
end;
end;
Location(Where, Name);
Set_HasTitle(iLCID, True);
ChartTitle[iLCID].Characters[EmptyParam,EmptyParam].Text :=
'WorldxChange Customer Joins';
IDispatch := Axes(xlCategory, xlPrimary, iLCID);
IDispatch.AxisTitle.Characters[EmptyParam,EmptyParam].Text := 'Date';
IDispatch := Axes(xlValue, xlPrimary, iLCID);
IDispatch.AxisTitle.Characters[EmptyParam,EmptyParam].Text :=
'Number';
end;
end;
If anyone can help it would be much appreciated.
Damien Long
Application Programmer
WorldxChange
[EMAIL PROTECTED]
Tel. (02) 9937 3854
Mobile 0417 144 812
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"