CQL get a shape by name

Hello 

I try to get a shape with CQL by the name "legend".

Following CQL commands I try but it is failling all the time:

page.shapes.findShapes(Query:="@type='text:artistic' and @com.name='legend')")

I always get the error number 91 back from corel.

The following comand failed as well:

page.shapes.findShapes('legend')

Got the same error.

Regards,
Christian

  • Name is directly supported you do not need to use com to access it. Here is a quick example that will show the count of those found.

    Sub FindTextLegend()
        Dim srFound As ShapeRange
        
        Set srFound = ActivePage.Shapes.FindShapes(Query:="@type='text:artistic' and @name='legend'")
        MsgBox srFound.Count
    End Sub