Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I have added a button into the excel toolbar,I wrote the code to
respond a buttonclick,and my purpose is to add an activex control i wrote myself,its name is "OCXTEST.OcxtestCtrl.1",but it fails.Every time I click the button,excel shutdown.But if I replace "OCXTEST.OcxtestCtrl.1" with _T("Form.ListBox.1"),it passed. And if i use COleVariant,I have to add a header"afxdisp",but in this case,it even can't compile successfully.Why? The main code is he using namespace MSExcel; CComPtr <MSExcel::_Application m_ExcelApp; CComPtr <MSExcel::Shapes m_Shapes; IDispatchPtr m_ActiveSheet; m_ActiveSheet=m_ExcelApp-GetActiveSheet(); m_Shapes=((_WorksheetPtr)m_ActiveSheet)-GetShapes(); // HINSTANCE result=ShellExecute(NULL, _T("open"), _T("http://club.excelhome.net"), NULL,NULL, SW_SHOW); // COleVariant ClassType("OCXTEST3.Ocxtest3Ctrl.1"); HRESULT hr=m_Shapes-AddOLEObject("OCXTEST.OcxtestCtrl.1",vtMissing,vt Missing,vtMissing,vtMissing,vtMissing,vtMissing,vt Missing,vtMissing,vtMissing,vtMissing); if(FAILED(hr)) return ; return; |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? | Excel Discussion (Misc queries) | |||
Display form from an VB application in Excel | Excel Discussion (Misc queries) | |||
date format in excel not in line with control panel regional setti | Excel Discussion (Misc queries) | |||
Do you know of a Calibration Control spreadsheet in Excel? | Excel Worksheet Functions | |||
Difference in number of Excel NewsGroups | Excel Discussion (Misc queries) |