??????????????????????COM??????
????1????OnInitDialog()?????г????COM????
????<span style="white-space:pre">    </span>SetIcon(m_hIcon?? TRUE);            // ????????
????SetIcon(m_hIcon?? FALSE);        // ????С???
????// TODO:  ??????????????????
????::CoInitialize(NULL);   //?????COM????
????return TRUE;  // ????????????????????????? TRUE
????2??????OnDestroy??????????????COM?????????????
????void CExportExcelDlg::OnDestroy()
????{
????CDialog::OnDestroy();
????::CoUninitialize(); //???COM????
????}


????????Excel???????
????????????Excel????????????????Add Class->From a type library????Excel???·???????EXCEL.exe??????????Щ???????????_Application??Workbooks??_Workbook??Worksheets??_Worksheet??Range????(???????VS2103???????Щ????????????????(.h)?????.cpp?????????Щ???????????????????????????£????????????ò??????????????????????VC6.0?????????????????????????????????????к??????????????????)??


???????????????excel???
?????????ü???Excel??????????????????????Debug??????н??????Excel??????????template.xls
 

?????????????Button?????????????????ú???????????????£?

 

<span style="white-space:pre">    </span>Range m_ExlRge;
_Worksheet m_ExlSheet;
Worksheets m_ExlSheets;
_Workbook m_ExlBook;
Workbooks m_ExlBooks;
_Application m_ExlApp;
COleVariant covTrue((short)TRUE)?? covFalse((short)FALSE)?? covOptional((long)DISP_E_PARAMNOTFOUND?? VT_ERROR);

 

?????塢????Excel????
????<span style="white-space:pre">    </span>if (!m_ExlApp.CreateDispatch(L"Excel.Application"?? NULL))  ///??m_ExlApp??????Excel????
????{
????AfxMessageBox(L"????Excel???????!");
????return;
????}