Problem with InvokeHelper running a macro in debug

  • Thread starter Kristopher Wragg
  • Start date
K

Kristopher Wragg

I've got a problem with some code that runs a macro via InvokeHelper,
for some reason the code fails when run in debug but not in release,
just wondering if anyone could help point out why?

The method is:

bool CaExcel::RunMacro(CString& strName)
{
COleVariant cov((long)DISP_E_PARAMNOTFOUND, VT_ERROR);

try
{ // there may not be a macro then what happens? lets fail silently

m_app.Run( COleVariant( strName ),
cov,cov,cov,cov,cov,cov,cov,cov,cov,cov,
cov,cov,cov,cov,cov,cov,cov,cov,cov,cov,
cov,cov,cov,cov,cov,cov,cov,cov,cov,cov
);

}
catch (COleDispatchException* e)
{
// This exception will be thrown if the macro
// does not exist for example.
e->Delete();

return false;
}
catch(...)
{
return false;
}

return true;
}

which makes a call to a Run method which is basically a wrapper for:

InvokeHelper(0x103, x x x x x x x x x x x x x

Compiling with Visual Studio 6, not sure if its a problem with the
code or MS debug libraries? But it seems to fail as the method is
clearing up its resources, which is very perculiar.
 
Top