LucieLastic
Programmer
hi
I've been looking at svanels thread in FAQ and come up with this lean version. All I need to do is poke a string in to one cell and fire off an Excel macro but I can't get the last line to compile, comes up with "'[' excpected but ':=' found". Can someone put me right? Also, can anyone tell me how to fire off a macro in XL?
procedure TForm1.Button2Click(Sender: TObject);
var ws : _Worksheet;
begin
ExcelApp.connect;
ExcelSheet.ConnectTo(ExcelApp.Worksheets.Item['TEST'] as _Worksheet);
ws := ExcelApp.ActiveSheet as _Worksheet;
ws.Range['A3', 'A3'].Value := edValue.text;
end;
Btw, I have an ExcelApplication and ExcelWorksheet on my form. I added the 'ws' bit after as I thought I was doing something wrong with the Worksheet component because of the same error.
Thanks in advance
Lou.
I've been looking at svanels thread in FAQ and come up with this lean version. All I need to do is poke a string in to one cell and fire off an Excel macro but I can't get the last line to compile, comes up with "'[' excpected but ':=' found". Can someone put me right? Also, can anyone tell me how to fire off a macro in XL?
procedure TForm1.Button2Click(Sender: TObject);
var ws : _Worksheet;
begin
ExcelApp.connect;
ExcelSheet.ConnectTo(ExcelApp.Worksheets.Item['TEST'] as _Worksheet);
ws := ExcelApp.ActiveSheet as _Worksheet;
ws.Range['A3', 'A3'].Value := edValue.text;
end;
Btw, I have an ExcelApplication and ExcelWorksheet on my form. I added the 'ws' bit after as I thought I was doing something wrong with the Worksheet component because of the same error.
Thanks in advance
Lou.