Hi, if I'm OT here please indicate me the right ng.
I'm trying to access a cell on an Excel sheet via ADO using R1C1 type
coordinates; I've a TADOTable, i set the proper connection string:
....
qXLS2 := TADOTable.Create(Self);
conXLS := TADOConnection.Create(Self);
conXLS.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=' + Trim(FileName) + ';' +
'Extended Properties="Excel 8.0;HDR=NO;IMEX=1";Persist Security
Info=False';
conXLS.LoginPrompt := FALSE;
qXLS2.Connection := conXLS;
qXLS2.TableDirect := TRUE;
....
then I read the coordinates (row and column) from another table:
....
R := qXLS1.FieldByName('Row').AsInteger;
C := qXLS1.FieldByName('Column').AsInteger;
SheetZone := 'R' + IntToStr(R) + 'C' + IntToStr(C);
SheetZone := SheetZone + ':' + SheetZone;
try
qXLS2.Active := FALSE;
qXLS2.TableName := SheetName + '$' + SheetZone;
qXLS2.Active := TRUE;
except
on E: Exception do
begin
MessageDlg(E.Message, mtError, [mbOk], 0);
EXIT;
end;
end;
....
You see I use a syntax like: "Sheet1$R1C1:R1C1" in the TableName
attribute, but I see it's not proper because I obtain an error
message; I know that a string like "Sheet1$A1:A1" is ok and doesn't
give me errors, so I'd like to find a way to use the R1C1 coordinates
in the TableName attribute or a way to convert all the R1C1 type
coordinates in corresponding A1 coordinates.
Can anyone help me?
TIA
Dario