If I assign this code to run via button press in a form, it will crash coreldraw. I still don't understand why that happens and if there is a way to run this code with a button.
Dim OrigSelection As ShapeRange Set OrigSelection = ActiveSelectionRange Dim s1 As Shape Set s1 = OrigSelection(1).Outline.ConvertToObject
grogo said:If I assign this code to run via button press in a form, it will crash coreldraw. I still don't understand why that happens and if there is a way to run this code with a button.
I tried your code, launched by a command button in a userform, and it didn't crash 2019 for me.
It works for me as well. I just need to put in an error handling deal (On error, resume next and whatnot)
If you draw a rectangle, apply an outline, then click the button the convert the outline to object. Now click on the button again while the object is still selected and BOOM. crash. If by some weird chance there is no outline, the program freaks out.
Actually 'On error resume next'. Didn't work for me. I'll need something conditional like if no outline, then do nothing, else convert outline to object.
I tried this but can't figure out what's wrong.
Set s = ActiveSelectionIf s.Outline.SetNoOutline Then Exit Sub (maybe not exit, just do nothing)
Else: s.Outline.ConvertToObjectEnd If
Outline.SetNoOutline is a method. I think you need to look at a property.
Dim s As Shape
Set s = ActiveShape
If Not s.Outline.Type = cdrNoOutline Then
MsgBox "Active shape has no outline."
The business of evaluating objects to find out if a particular operation is possible can get complicated.
at a loss. perhaps there is a way to have a button deactivated if not outline (<0) then activate the button if there is an outline (>0).