Excel 2000 automation problem

N

Nicolas

Hi,

I want to do the following with automation :

* Get a cell that is containing a formula (let's call it A1).
* Resize the range to be 5 by 5
* Enter a new formula in A1 that will be an array function and output in the
new range.

I did the following :

try
{

lpDisp= m_pExcelApplication.GetActiveSheet();
_Worksheet workSheet;
workSheet.AttachDispatch(lpDisp);
lpDisp = workSheet.GetRange(COleVariant("B4"),
COleVariant("B4"));
Range range;
range.AttachDispatch(lpDisp);
range.SetValue(COleVariant("asdf"));
}
catch (COleDispatchException *e)
{
char buf[1024]; // For the Try...Catch error message.
sprintf(buf,"COleDispatchException. SCODE: %08lx, Description:
\"%s\".",(long)e->m_wCode,(LPSTR)e->m_strDescription.GetBuffer(512));
::MessageBox(NULL, buf, "COleDispatchException",
MB_SETFOREGROUND | MB_OK);
}

But it doesn't work.
I always get a "COleDispatchException" with SCODE of 00000000
class" error.

Can anybody help me?

Thanks

Nic
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top