Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm not an expert at using Excel with C++ and MFC. try your original code
and change from: Value2 to: Value (eliminate the 2). "Gaurav" wrote: On Jan 8, 6:09 am, Joel wrote: See if this works with m_Excel Range rp = .GetRange(.COleVariant("C1"), .COleVariant("C1")); rp.SetValue2(.COleVariant("Hi")); end with "Gaurav" wrote: Hi, i am getting an exception when trying to open an existing file and write something into it. if i create a new worksheet, the code works fine. I am not able to findout the problem. Please look at the code and let me know what is wrong with it. ERROR_PROTECT_BEGIN_PROXY() Range rp = m_Excel.GetRange(COleVariant("C1"), COleVariant("C1")); rp.SetValue2(COleVariant("Hi")); // <------throwing Exception ERROR_PROTECT_END_PROXY("Error Copying") void __stdcall CExcelProxy::OnWorkBookOpen(IDispatch *Wb) { DEBUG_MESSAGE("Opening Workbook"); // Load Macro into VBE for callbacks LoadMacro(); m_pWorkBook = Wb; m_pWorkSheet = m_pWorkBook-GetActiveSheet(); m_pWorkSheet-Protect(false); // Set class-wide indicator IDispatchPtr pDsp; // Get reference to comand bars pDsp = (Office::CommandBarsPtr)m_pApp-GetCommandBars(); m_pCmdBars = pDsp.Detach(); // Release pointers ReleaseWorkBookPtrs(); ReleaseCommandBarPtrs(); } void __stdcall CExcelProxy::OnNewWorkBook(IDispatch *Wb) { IDispatchPtr pDsp; // Get reference to comand bars pDsp = (Office::CommandBarsPtr)m_pApp-GetCommandBars(); m_pCmdBars = pDsp.Detach(); // Show "Save" menus UpdateSaveMenus(true); // Release all pointers ReleaseCommandBarPtrs(); // Load macro for callbacks LoadMacro();- Hide quoted text - - Show quoted text - Used the same code and it is not working |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
exception 0x800A03EC in excel | Excel Programming | |||
Excel writting | Excel Discussion (Misc queries) | |||
writting excel formulas in english in spanish version of office. | Excel Programming | |||
Writting a MAcro in Excel | Excel Programming | |||
Excel exception problem | Excel Programming |