Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CorelDraw x3 VBA - Change shape layers

Status
Not open for further replies.

Malik641

Programmer
Nov 29, 2006
11
US
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:

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
 
Ok. I got it. I had to change ActiveWindow.Refresh to Application.Refresh.

:) Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top