C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[66170] SaveDialog1 이용해서 스트링그리드에 엑셀 자료 저장..
김태우 [hananet0282] 1298 읽음    2012-02-04 20:16
이렇게 해주고 있습니다...
디버깅 해보니.. 이부분 이라는곳에서 문제가 되구요...
프로그램을 구동해보면 알 수 없는 이름 이라는 에러가 표시 되더라구요...
무슨 문제인지...


if(SaveDialog1->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 < StringGrid1->ColCount; Col++)
            {
                for(int Row = 1; Row < StringGrid1->RowCount; Row++)
                {
                    ExcelData = StringGrid1->Cells[Col][Row];
                    cells = excel_sheet.OlePropertyGet("Cells",Col , Row); //Cell선택
                                cells.OlePropertySet("Value", WideString(ExcelData));
                        }
                }

                excel_books.OleProcedure("SaveAs" ,SaveDialog1->FileName); // <--이부분
                excel_books.OleFunction("Close", (Variant)False);
                excel_sheet = Unassigned;
                excel_book = Unassigned;
                excel_app.OleFunction("Quit");
                excel_app = Unassigned;
            this->Memo1->Lines->Add(SaveDialog1->FileName);
      }

+ -

관련 글 리스트
66170 SaveDialog1 이용해서 스트링그리드에 엑셀 자료 저장.. 김태우 1298 2012/02/04
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.