LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default exception in excel while writting to it

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();
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
exception 0x800A03EC in excel Joao Mossmann Excel Programming 1 October 25th 07 07:12 PM
Excel writting Ken Excel Discussion (Misc queries) 2 June 12th 07 10:34 PM
writting excel formulas in english in spanish version of office. Edge Excel Programming 0 August 26th 05 11:09 PM
Writting a MAcro in Excel Rasoul Khoshravan Azar Excel Programming 1 December 30th 04 01:37 PM
Excel exception problem Chuck Ainslie Excel Programming 0 June 4th 04 09:01 PM


All times are GMT +1. The time now is 04:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"