see above
1 2 3
Dim s As Shape Set s = ActiveShape If s.Type = cdrContourGroupShape Then MsgBox "This shape has a contour...", , "Test Contour"
Myron said:That's awesome FaneDuru! Only trouble is that it errors out if clicking on the workspace Needs an "If No selection then exit sub"?
Strange...
In my X8 it works well. 'If Not s Is Nothing' does exactly that. It goes on only if a shape is selected...
Where did you receive the error? I mean in which line?
Is it possible that X7 behaves different on such a simple code? Maybe it does not allow to a range to be considered a shape (in case of multiple selection). X8 does...
Myron said:Uh...already found another one to work on. If I can just figure out how to make a SelectionChange() stop the loop once a code has run it's coursesomething like - now that the shape meets the criteria exit the sub
I'm not sure I understood what you mean. Maybe because I'm not a native English speaker...
On my understanding you already used such a way: "If ActiveSelectionRange.Count = 0 Then Exit Sub"
Can you be more specific on this issue?
Isn't it simpler to post the problematic code explaining what is going wrong...?
Probably condition to stop the loop is never true.
If you have "scale with object" checked and you "stretch" the shape your outline gets wonky. Seems a little macro could be run to reset the nib stretch back to 100. As well as the Nib Angle back to Zero. I'm almost there (see the code below) trouble is that it keeps going and going until you hit escape
Private Sub GlobalMacroStorage_SelectionChange()
Dim sr As ShapeRange, s As Shape
If ActiveSelectionRange.Count = 0 Then Exit Sub
If ActiveSelectionRange.Count > 0 Then
Set sr = ActiveSelectionRange
For Each s In sr
s.Outline.NibStretch = 100
s.Outline.NibAngle = 0
Next s
End If
End Sub
I'm afraid that it's a problem with Corel way of understanding selection change. I mean I tested your code and I observed that Corel application treats every outline modification like a selection change, triggering the event...
I used the next code which shows in Immediate Window that any outline modification triggers selection change event. If you programmatically modify something which triggers the event it will go in an infinite loop produced by modification itself. Maybe you will consider another way to do that...
Private Sub GlobalMacroStorage_SelectionChange() Dim sr As ShapeRange, s As Shape, nO as long If ActiveSelectionRange.Count = 0 Then Exit Sub If ActiveSelectionRange.Count > 0 Then Set sr = ActiveSelectionRange For Each s In sr nO =nO +1 Debug.Print nO Next s End If Debug.Print "The code has been finished..." End Sub
x