|
아래의 코드가 작성중인 프로젝트에선 EACCESSVIOLATION ERROR가 납니다.
새 프로젝트를 하나 만들어서 실행해 보면 잘 되구요..
해결방법 빨리 좀 부탁드립니다.
#include <utilcls.h>
#include <ComObj.hpp>
Variant xlApp, xlBooks, xlBook, xlSheets, xlSheet, VCell;
if(xlApp.IsEmpty())
{
try
{
xlApp = CreateOleObject ("Excel.Application");
}
catch (Exception &exception)
{
ShowMessage("Excel이 설치되어 있지 않습니다.");
return;
}
}
xlApp.OlePropertySet("DisplayAlerts", false);
xlApp.OlePropertySet("Visible", false);
xlBooks = xlApp.OlePropertyGet("Workbooks");
xlBooks.OleProcedure("Open", "c:\\test9.xls");
xlBook = xlBooks.OlePropertyGet("Item", 1);
xlBook.OleProcedure("PrintOut");
xlBook.OleProcedure("Close");
xlApp.OleProcedure("Quit");
|