|
SaveAs는 우리말로 "다른이름으로 저장" 이잖아요?
엑셀에서도 SaveAs하고 같은 이름으로 저장하려면 문제가 되지 않나요?
덥어쓸까하고 확인창이 뜨던데...
SaveAs하지 마시고 그냥 Save만 하시면 될듯 한데요
excel_books.OleProcedure("Save");
그럼..
소병관 님이 쓰신 글 :
: 오늘도 질문을 올리네요^^;;
: 데이타를 새로운 엑셀파일을 형성해서 저장하려고 하는데요...
: 포럼에 있는 답변들을 가지고 프로그램을 작성했는데 에러가 나네요...
: 다른분께서 똑같은 경우를 질문하셨는데 답변이 없어서 제가 다시 질문을 올립니다.
: 고수님들께서 도와주시면 감사하겠습니다.
:
: Variant excel_app;
: Variant excel_book, excel_books;
: Variant excel_sheet;
: Variant cells;
: Variant Data;
: WideString ExcelData;
: AnsiString asFileName;
:
: if(SaveDialogProcess->Execute())
: {
: excel_app = Variant::CreateObject("excel.application");
: excel_app.OlePropertySet("Visible", (Variant)false);
:
: excel_books = excel_app.OlePropertyGet("Workbooks");
: excel_book = excel_books.OleFunction("Add", 1);
: excel_sheet = excel_book.OlePropertyGet("ActiveSheet");
:
: // read Data
: for(int Col = 1; Col < iGridCol; Col++)
: {
: for(int Row = 1; Row < iGridRow; Row++)
: {
: ExcelData = StringGrid->Cells[Col][Row];
: cells = excel_sheet.OlePropertyGet("Cells",Col , Row); //Cell선택
: cells.OlePropertySet("Value", WideString(ExcelData));
: }
: }
:
: excel_books.OleProcedure("SaveAs" ,SaveDialogProcess->FileName.c_str()); // <--이부분
: excel_books.OleFunction("Close", (Variant)False);
: excel_sheet = Unassigned;
: excel_book = Unassigned;
: excel_app.OleFunction("Quit");
: excel_app = Unassigned;
: }
|