invert selection of the below script is not working, someone help

Private Sub SelectionInverse()
Dim SHAPE_BhBp As Shape

For Each SHAPE_BhBp In ActivePage.Shapes

If SHAPE_BhBp.Selected = True Then
SHAPE_BhBp.Selected = False
Else
SHAPE_BhBp.Selected = True
End If

Next
End Sub

Parents
No Data
Reply
  • the selected property is to be used only with an object, it doesn't work for selection.

    This is a code in C#, which performs the procedure, someone from VBA can easily rewrite it for you


    [CgsAddInMacro]
    public void InvertSelection()
    {
        ShapeRange selectedRangeallRange;
     
        selectedRange = corelApp.ActiveSelectionRange;
        allRange = corelApp?.ActivePage.Shapes.All();
     
        allRange.RemoveRange(selectedRange);
        selectedRange.RemoveFromSelection();
        allRange.AddToSelection();
     
    }
Children
No Data