When running our application, it is crashing in the following line of code,
*pResult = g_pExcel->Run(Temp1,argVariant);
Below is the code. I am not able to find why it is crashing. Is there any type conversion problem?
CExec::CallRunVbtFunc(BSTR MacroName,
SAFEARRAY** ArgVals,
int *pResult)
{
_bstr_t Temp1 (MacroName);
CComVariant argVariant(*ArgVals);
argVariant.vt = VT_ARRAY | VT_BSTR;
*pResult = g_pExcel->Run(Temp1,
argVariant);
return S_OK;
}
Public Function MyTesting() As Long
Dim aa(1) As String
aa(0) = "aaa"
aa(1) = "bbb"
TheExec.CallRunVbtFunc "Macro3", aa
End Function
Sub Macro3(argc As String, argv As String)
TheExec.WriteComment "Called Macro2 with args*************** "
End Sub