|
안녕하세여..
제가 엑셀에 값을 넣을려고 작업하는 도중 에러가 나서 이렇게 글을 쓰게 되었습니다..
#include <utilcls.h>
#include <comobj.hpp>
#include <except.h>
.
.
.
.
.
.
.
{
Variant xlApp, xlBooks, xlBook, xlSheets, xlSheet, VRange;
....
....
....
....
xlApp = CreateOleObject("Excel.Application");
xlApp.OlePropertySet("DisplayAlerts", false); <- 여기서 바로 에러가 떨어집니다.. 왜그런지??
에러 : Access Violation......XXXXXXXXXXX XXXXX. <- 아무래도 xlApp가 널로 떨어진것 같은데..모르겠네여..
if ( true ) xlApp.OlePropertySet("Visible", true);
else 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", String("QC Data") );
...
...
...
...
}
그런데 이상한 점은...
*******위와 같은 코드를 다른 테스트 프로젝트에 넣어 돌려보면 잘 돌아 갑니다.. *********
그런데 막상 구현해야 되는 프로젝트에 넣으면 저기에서 에러가 납니다.. 왜 그런지.. 혹시 아시분 계시분 도움 주셨으면 감사하겠습니다... ^
|