LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Error Code Handling

Solved!
Go to solution

Hi all,

 

I am writing a program that interacts with Excel. For debugging purposes I want to display messages that correspond to the error codes. Has someone already written a function that does this? I ask, because I imagine there are too many error codes to quickly write this up.

 

Thanks in advance,

 

Turbo

0 Kudos
Message 1 of 3
(3,738 Views)
Solution
Accepted by topic author TurboMetrologist

Does a function like this answer your question?

 

//----------------------------------------------------------------------------
// ReportAppAutomationError
//----------------------------------------------------------------------------
void ReportAppAutomationError (HRESULT hr, int line)
{
    char errorBuf[512];


    if (hr < 0) {
        CA_GetAutomationErrorString (hr, errorBuf, sizeof (errorBuf));
        sprintf (errorBuf, "%s (line %d)", errorBuf, line);
        MessagePopup ("Severe error", errorBuf);
    }
    return;
}

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,723 Views)

Yes, thank you.

0 Kudos
Message 3 of 3
(3,692 Views)