Hi
how can I creat a macro to delete all horizontal lines?
Thanks
Sub Delete_H_Lines()Dim sr As ShapeRange, s As Shape, h#ActiveDocument.BeginCommandGroup "Delete_H_Lines"Optimization = TrueActivePage.Shapes.All.AddToSelectionSet sr = ActiveSelectionRangeFor Each s In srIf s.SizeHeight <= 0.001 Thens.DeleteEnd IfNext sActiveDocument.EndCommandGroupOptimization = False ActiveWindow.RefreshEnd Sub
This is assuming all lines are perfectly horizontal. Rotated even the slightest or 1 node not on the same plane as the other would have a height and therefore wouldn't be deleted.
i wanted to stay just with the lines upright, so to erase the others i did a If s.sizeHeight<>0 and s.sizeWidth<>0 but lays the program down
Whow can i delete all shapes with only 2 nodes? is there a simple line of code to do that?
XenaPG said:Whow can i delete all shapes with only 2 nodes? is there a simple line of code to do that?
You can use Corel Query Language (CQL) for that:
Sub delete_selected_2_node_curves() Dim sr As ShapeRange Set sr = ActiveSelectionRange.Shapes.FindShapes(query:="@com.type = " & cdrCurveShape & "and @com.curve.nodes.count = " & 2) sr.Delete End Sub