|
답변 진심으로 감사합니다.
그런데 문제는 여전히 발생하는 군요 ㅜ.ㅜ
awb.OleProcedure("Save");
awb.OleProcedure("Close");
ex.OleProcedure("Quit");
이 부분에서 "alex"님께서 알려주신데로 하면 여전히 문제가 발생하구요
awb.OleProcedure("Save");
awb.OleProcedure("Close",(Variant)false );
ex.OleProcedure("Quit");
위에서 Save 를 빼면 팝업창은 안뜨는데 저장은 안되는군요 ㅜㅡ;;;;;;
//awb.OleProcedure("Save");
awb.OleProcedure("Close",(Variant)false );
ex.OleProcedure("Quit");
잉~~ ㅜ.ㅜ 어떻게 방법이 없을까요?
화면 켑춰하여 올립니다.
alex 님이 쓰신 글 :
: Chane to this..
:
: awb.OleProcedure("Close",(Variant)false );
:
:
: 우리 님이 쓰신 글 :
: : 엑셀파일을 열어서 읽고 셀 하나에 값을 넣고
: :
: : 저장하고 나오는 간단한 소스입니다.
: :
: : 그런데 실행하면 팝업창이 뜨면서 "이미 기존파알이 있으니 교체하겠냐" 는 메시지가 뜹니다.
: :
: : 이거 안뜨게 하고 바로 저장하게 할수는 없나요?
: :
: : 고수님들 알려주세요 ~ ^^;;
: :
: : //---------------------------------------------------------------------------
: : #include <vcl.h>
: : #pragma hdrstop
: :
: : #include "utilcls.h"
: : #include <graphics.hpp>
: : #include "Unit1.h"
: : //---------------------------------------------------------------------------
: : #pragma package(smart_init)
: : #pragma resource "*.dfm"
: : TForm1 *Form1;
: : //---------------------------------------------------------------------------
: : __fastcall TForm1::TForm1(TComponent* Owner)
: : : TForm(Owner)
: : {
: : }
: : //---------------------------------------------------------------------------
: :
: : void __fastcall TForm1::Button1Click(TObject *Sender)
: : {
: : Variant ex=Variant::CreateObject("Excel.Application");
: : ex.OlePropertyGet("WorkBooks").OleProcedure("Open","c:\\test.xls");
: : Variant awb=ex.OlePropertyGet("ActiveWorkBook");
: : Variant sh=awb.OlePropertyGet("ActiveSheet");//엑티브sheet
: : // Variant sh=awb.OlePropertyGet("Sheets").OlePropertyGet("item",1);//sheet1
: : // Variant sh=awb.OlePropertyGet("Sheets").OlePropertyGet("item",2);//sheet2
: :
: : int row=sh.OlePropertyGet("UsedRange").OlePropertyGet("Rows").OlePropertyGet("Count"); //row갯수
: : int col=sh.OlePropertyGet("UsedRange").OlePropertyGet("Columns").OlePropertyGet("Count");//col갯수
: :
: : StringGrid1->RowCount=row+1;
: : StringGrid1->ColCount=col+1;
: :
: : for(int j=0;j<row;j++){
: : for(int i=0;i<col;i++){
: : StringGrid1->Cells[i+1][j+1]=sh.OlePropertyGet("Cells",j+1,i+1).OlePropertyGet("Value");
: : }
: : }
: :
: : sh.OlePropertyGet("Cells").OlePropertySet("_Default", 1, 1, "test");
: :
: : awb.OleProcedure("Save");
: : awb.OleProcedure("Close");
: : ex.OleProcedure("Quit");
: :
: : awb=Unassigned;
: : ex=Unassigned;
: :
: : }
|