hello i use bcb6 and i have problem with export every line from a memo to a different cells in a excel.i have write this code but export only the first line in the first cell exported.
this is my code:
Code:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ExcelApplication1->Connect();
ExcelApplication1->Workbooks->Add();
ExcelWorkbook1->ConnectTo(ExcelApplication1->ActiveWorkbook);
ExcelWorksheet1->ConnectTo(ExcelApplication1->ActiveSheet);
ExcelApplication1->set_SheetsInNewWorkbook(LOCALE_USER_DEFAULT, 1);
int j;
int i;
for (j=2;j<=Memo1->Lines->Count;j++)
{
for(i=1;i<Memo1->Lines->Count;i++)
{
AnsiString temp = Memo1->Lines->Strings[i];
ExcelWorksheet1->Cells->set_Item(TVariant(j), TVariant("A"), TVariant(temp));
ExcelApplication1->set_Visible(LOCALE_USER_DEFAULT,1);
ExcelApplication1->Disconnect();
}
}
}
have you any ideas for my problem;
thank you in advance