|
아래 엑셀 버튼을 클릭하면 엑셀이 정상으로 활성화가 되는데 다른 함수에서
강제로 이벤트(Form1->ExcelOpenProc->Click();)를 발생시켜 아래 함수에서 엑셀을 오픈하려하면
"faulted with message: 'application-defined exception(code 0x00000000) at 0x77a7978'. Process stoped. Use step or Run to continue" 라는 에러가 뜨네요...
뭐가 원인인지 모르겠네요--
void __fastcall TForm1::ExcelOpenProcClick(TObject *Sender)
{
excel_app = Variant::CreateObject("excel.application");
excel_app.OlePropertySet("Visible", (Variant)true);
excel_books = excel_app.OlePropertyGet("Workbooks");
excel_book = excel_books.OleFunction("Add", 1);
excel_sheet = excel_book.OlePropertyGet("ActiveSheet");
sprintf(sBuf, "Time");
cells = excel_sheet.OlePropertyGet("Cells",1 , 1); //Cell선택
cells.OlePropertySet("Value", sBuf);
}
|