How can i find a certain curve in every shape and convert just that curve into a different one

is there any way to convert a curve into another whenever it is present in a shape? I have these two shapes (image below) and I want to convert all the curves that are equal to
that triangle (wrong one) to a single line like in the example (right one).

(I'm using VBA to do it, if necessary I can provide a .plt file with an example of these two shapes)

If anyone can help me with this I'll be very grateful