자유롭게 질의 및 응답을 할 수 있는 게시판입니다. 개발자 여러분의 답변이 큰 도움이 됩니다. 
  • 제품설치/등록 오류 문의: 설치/등록 Q&A 이용 (제품 구매 고객 한정)

본 게시판은 개발자들이 자유롭게 질문과 답변을 공유하는 게시판입니다.
* 따라서 최대한 정중하게 질문을 올려 주세요.
* 질문을 상세히 작성해 주실 수록 좋은 답변이 올라 옵니다.
* 다른 분들도 참고할 수 있도록 결과 댓글 필수(또는 감사 댓글)
(결과 댓글을 달지 않는 경우 다음 질문에 대한 답변이 달리지 않는 불이익이 있을 수 있습니다.)
-----------------------------------------------------------------------------------------------

안녕하세요

10.1 도쿄버전 c++빌더 사용중입니다.

아래와 같이 특정 폴더에 있는 엑셀 파일을 열어서 수정하고 저장하는 기능을 구현중인데

"피호출자를 호출하지 못하였습니다."라는 오류 메시지가 뜨네요

그리고 작업관리자에 엑셀일 실행이 되고있어 일일일 수작업으로 지워줘야하구요

설정에 문제가 없는지 확인 부탁드립니다.

 


char dBuf[100];
int excel_col;
Variant excel_app;
Variant excel_book, excel_books;
Variant excel_sheet;
Variant excel_window;
Variant cells;
Variant Data;
Variant interior;
Variant column;
WideString ExcelData;
AnsiString asFileName;
Variant value;

 

String DefaultOpenPath={"C:\\ICS Default Set\\ICS Default Set.xlsx"};


void __fastcall TMainForm::Button_DefaultSaveClick(TObject *Sender)
{
  AnsiString TestStr, StrPoint;
  WideString Temp, SaveStr;
  char sTemp=0;


  Temp=DefaultOpenPath;

  excel_app=Variant::CreateObject("excel.application");                      //Excel 프로그램 실행
  excel_app.OlePropertySet("Visible", (Variant)false);                        //Excel 프로그램 Visible설정
  excel_app.OlePropertyGet("WorkBooks").OleProcedure("Open",Temp);
  excel_book=excel_app.OlePropertyGet("ActiveWorkbook");                     //현재 Active된 WorkBook 선택
  excel_sheet=excel_book.OlePropertyGet("ActiveSheet");                      // WorkBook에서 Acitve된 Sheet선택
  excel_app.OlePropertySet("DisplayAlerts", false);                                   //파일 저장 묻기 메시지 off
 

 

  TestStr=(Ru_MainForm->ComboBox_HighTemp->ItemIndex+80);
  strcpy(dBuf, TestStr.c_str());
  cells = excel_sheet.OlePropertyGet("Cells",TempHighPoint[0], TempHighPoint[1]);
  cells.OlePropertySet("Value", WideString(dBuf));

 

  if(Ru_MainForm->CheckBox_Fa1->Checked==false)    TestStr="OFF";
  else              TestStr="ON";
  strcpy(dBuf, TestStr.c_str());
  cells = excel_sheet.OlePropertyGet("Cells",Fa1_SetupPoint[0], Fa1_SetupPoint[1]);
  cells.OlePropertySet("Value", WideString(dBuf));

 

  if(Ru_MainForm->CheckBox_Fa5->Checked==false)    TestStr="OFF";
  else              TestStr="ON";
  strcpy(dBuf, TestStr.c_str());
  cells = excel_sheet.OlePropertyGet("Cells",Fa5_SetupPoint[0], Fa5_SetupPoint[1]);
  cells.OlePropertySet("Value", WideString(dBuf));


  strcpy(dBuf, TestStr.c_str());
  cells = excel_sheet.OlePropertyGet("Cells",AutoShutdownPoint[0], AutoShutdownPoint[1]);
  cells.OlePropertySet("Value", WideString(dBuf));

 

  TestStr=(Ru_MainForm->ComboBox_ConDlInputUpper->ItemIndex+31)*-1;
  strcpy(dBuf, TestStr.c_str());
  cells = excel_sheet.OlePropertyGet("Cells",DlInputUpperPoint[0], DlInputUpperPoint[1]);
  cells.OlePropertySet("Value", WideString(dBuf));

 

  TestStr=(Ru_MainForm->ComboBox_ConDlInputLower->ItemIndex+50)*-1;
  strcpy(dBuf, TestStr.c_str());
  cells = excel_sheet.OlePropertyGet("Cells",DlInputLowerPoint[0], DlInputLowerPoint[1]);
  cells.OlePropertySet("Value", WideString(dBuf));

 

  SaveStr=DefaultOpenPath;
  excel_book.OleProcedure("SaveAs",SaveStr);
  excel_book.OleFunction("Close", (Variant)False);
  excel_sheet = Unassigned;
  excel_book = Unassigned;
  excel_app.OleFunction("Quit");
  excel_app = Unassigned;
}

 

번호 제목 글쓴이 날짜 조회 수
공지 [프로그래밍 강의] 2021.6~2021.12 관리자 2015.01.22 15767
공지 유용한 관련 사이트 관리자2 2014.03.20 54580
공지 본 게시판은 개발자 여러분들의 질문과 답변을 공유하는 공간입니다. 관리자 2012.01.10 97985
84 ComboBox 바인딩 관련하여 질문드립니다. [2] file 총이 2015.01.09 972
83 SNMP V2 컴포넌트 [1] 수정아빠 2015.02.06 999
82 안녕하세요 현재 고2 논문작성하는데 개발자 소스코드+조언 부탁드려도될까요 ㅠㅠ [2] 브루스너구링 2018.07.22 1007
81 [에러] ISO C++17 does not allow 'register' storage class specifier [2] file lamp 2019.11.29 1013
80 cmake 테스트가 안됩니다. [1] 쿠리 2018.08.10 1074
79 compile error(link) [1] 우석이 2014.11.23 1128
78 [ilink32 Error] Fatal: Unable to open file 'FRXCLASS.OBJ' 오류가 발생합니다. 험프리 2017.03.24 1146
77 10.4 버젼 [1] 시작.. 2021.08.17 1182
76 RTL210.bpl 파일 관련 문의 드립니다. [1] 가나다99 2017.03.15 1207
75 OCX등록 (주)머든 2015.02.14 1241
74 실행파일 output 경로설정을 하고싶습니다. [4] 불청객 2015.08.04 1378
73 Open ssl 과 indy 관련 질문입니다. [8] 현수막 2019.01.23 1446
72 Timage Picture.data : Access Violation 문의 [1] file 유경아빠 2021.08.31 1552
71 BMP파일를 리딩하면 잘려서 보입니다. file barcode0 2014.08.06 1652
70 SQLConnection 컴포넌트 관련하여 다시 질문드립니다. [3] 총이 2014.12.17 1664
69 groupbox 및 checkbox 등의 font color 변경 안되는 사항 [2] goinma 2018.05.03 1681
68 Label 색을 변경을 하였는데, 컴파일해서 실행하면 검은색으로 표시됩니다. [6] 하루 2018.04.01 1712
67 윈도우 10, XE8 환경에서 한글 글자크기가 작습니다. [4] file benp 2016.10.18 1713
» 엑셀 저장, 읽기 기능에서 오류 문의 [2] 포세가이 2018.12.07 1713
65 [Kinvey] BaaS 강좌 실습 과정에서 에러가 발생합니다. file 소중한꿈 2014.09.20 1789