Returns the latest COM error.

Syntax

ErrorMessage = SRP_Com("", "ERROR")

Returns

The most recent error message, if there is any.

Remarks

The ERROR service returns the most recent error. That is, it contains any error message relating to the most recent SRP_Com call. For example, you can use the ERROR service immediately after the CREATE service to determine if the CREATE service had a failure. Note that the latest error is always reset when you use any other SRP_Com service.

Note that the first parameter of SRP_Com, usually used to pass an object reference, is ignored. Simply pass null.

The CREATE, RELEASE, and SET services return a success/failure value, so it's easy to know when to check the latest error. The GET and CALL services return property and method values respectively, so the latest error depends on whether or not these services returned unexpected results.

Example

// Instantiate the MSXML DOM Document object
 If SRP_Com(objXmlDoc, "CREATE", "Msxml2.DOMDocument") then         
     // Release the object when we're done with it
     SRP_Com(objXmlDoc, "RELEASE")
 end else
     Error = SRP_Com("", "ERROR")
 end
  • No labels