Search code examples
catia

Read Information displayed in Message Box


I'm working on Catia Automation.

The scenario is that whenever a particular licence is not available, a message pops out saying no licences are available and displays a partial list of users using the licence.

Is there any way in which the message can be read through code and used as a string?


Solution

  • Err is the error object that holds information about the error.

    you can use Err.Message, Err.description, Err.number to get the information

    Sub yoursub
    On Error goto error      ' goto error handling block
        Set CATIA=GetObject(,"CATIA.Application")
    
        // your code 
    
    error:
    Debug.print Err.Description  ' print description to immediate window
    Debug.print Err.Source       ' print source of error to immediate window
    Debug.print Err.Number       ' print error number to immediate window
    End Sub