|
파일이름에 : 는 쓸 수가 없습니다.
Beckham 님이 쓰신 글 :
: int i, j;
: Variant XLApp, XLSheets, XLSheet, XLBooks, XLBook;
: gStMValName = "\\D\\Measure" + FormatDateTime("YYYY-MM-DD HH:MM:SS", Now()) + ".xls";
:
: XLApp = CreateOleObject("Excel.Application");
: XLApp.OlePropertySet("DisplayAlerts", false);
: XLApp.OlePropertySet("Visible", false);
: XLBooks = XLApp.OlePropertyGet("Workbooks");
: XLBooks.OleProcedure("Add");
: XLBook = XLBooks.OlePropertyGet("Item", 1);
: XLSheets = XLBook.OlePropertyGet("Worksheets");
: XLSheet = XLSheets.OlePropertyGet("Item", 1);
: XLSheet.OlePropertySet("Name", "측정값");
: XLSheet = XLApp.OlePropertyGet("ActiveSheet");
:
: for (i = 0; i < sgrdMData->ColCount; i++)
: for (j = 0; j < sgrdMData->RowCount; j++) {
: XLSheet.OlePropertySet("Cells", j + 1, i + 1, sgrdMData->Cells[i][j].c_str());
: }
:
: XLBook.OleProcedure("SaveAs", gStMValName.c_str()); ----> 에러발생(EOleSysError with message '예외
: 가 발생했습니다" )
: XLBook.OleFunction("Close", (Variant)false);
: XLSheet = Unassigned;
: XLBook = Unassigned;
: XLApp.OleFunction("Quit"); //Excel 프로그램 종료
: XLApp = Unassigned;
:
:
: "XLBook.OleProcedure("SaveAs", gStMValName.c_str());" 이부분에서 "예외발생" 에러가 발생합니다.
: XLBook.OleProcedure("Save") 이렇게 하면 에러없이 내문서에 제대로 저장이 되는데..계속해서
: 다른이름으로 업데이트 해야하는 파일이라서 "SaveAs"를 사용해야 합니다.
:
: 고수님들 조언부탁드립니다. 감사합니다.
|