Hey guys,
First off, I hope there's somebody out there besides me that uses VBA in CorelDraw. Ok, anyway, I have the following code that places the active shape into another layer. Now, I keep an eye on it in the Object Manager to see it change position. Here's the code:
The problem is when you uncomment the Application.Optimization lines, the object "appears" to be changed, but the Object Manager is not updated. And the object is actually still in the previous layer that it was in before the code was ran except now it has all the properties of the layer I wanted to switch it to. What's going on here? Why would it work when Optimization is turned off and it doesn't when it is turned on?
Thanks in advance
Joseph
First off, I hope there's somebody out there besides me that uses VBA in CorelDraw. Ok, anyway, I have the following code that places the active shape into another layer. Now, I keep an eye on it in the Object Manager to see it change position. Here's the code:
Code:
Public Sub LayerConvert()
Dim shp As Shape
'Application.Optimization = True
For Each shp In ActiveSelection.Shapes
shp.Layer = ActivePage.Layers("Measurements")
Next
'Application.Optimization = False
ActiveWindow.Refresh
End Sub
The problem is when you uncomment the Application.Optimization lines, the object "appears" to be changed, but the Object Manager is not updated. And the object is actually still in the previous layer that it was in before the code was ran except now it has all the properties of the layer I wanted to switch it to. What's going on here? Why would it work when Optimization is turned off and it doesn't when it is turned on?
Thanks in advance
Joseph