|
이렇게 해주고 있습니다...
디버깅 해보니.. 이부분 이라는곳에서 문제가 되구요...
프로그램을 구동해보면 알 수 없는 이름 이라는 에러가 표시 되더라구요...
무슨 문제인지...
if(SaveDialog1->Execute())
{
excel_app = Variant::CreateObject("excel.application");
excel_app.OlePropertySet("Visible", (Variant)false);
excel_books = excel_app.OlePropertyGet("Workbooks");
excel_book = excel_books.OleFunction("Add", 1);
excel_sheet = excel_book.OlePropertyGet("ActiveSheet");
// read Data
for(int Col = 1; Col < StringGrid1->ColCount; Col++)
{
for(int Row = 1; Row < StringGrid1->RowCount; Row++)
{
ExcelData = StringGrid1->Cells[Col][Row];
cells = excel_sheet.OlePropertyGet("Cells",Col , Row); //Cell선택
cells.OlePropertySet("Value", WideString(ExcelData));
}
}
excel_books.OleProcedure("SaveAs" ,SaveDialog1->FileName); // <--이부분
excel_books.OleFunction("Close", (Variant)False);
excel_sheet = Unassigned;
excel_book = Unassigned;
excel_app.OleFunction("Quit");
excel_app = Unassigned;
this->Memo1->Lines->Add(SaveDialog1->FileName);
}
|