Manipulate CorelDraw layers

LayerActive

This one is also available in Corel, but the same as LayerCreate, Corel doesn't check first if the layer exists...

ATTENTION: Requires LayerExists Function (Page 2)

'Set active layer

Public Sub LayerActive(varLayerName As String)

   Dim varMsgBoxResult As Integer
   Set myDoc = Application.ActiveDocument
   If LayerExists(varLayerName) Then
       For Each Layer In myDoc.ActivePage.Layers
           If Layer.Name = varLayerName Then Layer.Activate
       Next
   Else
       varMsgBoxResult = MsgBox("Layer doesn't exist! Create a new layer called '" & varLayerName & "'?", vbYesNo, "ATTENTION!")
       If varMsgBoxResult = 6 Then LayerCreate (varLayerName)
   End If

End Sub

You might also like...

Comments

About the author

 Thamar

Thamar Poland

I was born in a small town in Holland, and currently live in Poland. I'm fluent in English, German, Polish and Dutch, speak a bit of French and Russian. After finishing Information Technologies ...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are only two kinds of languages: the ones people complain about and the ones nobody uses” - Bjarne Stroustrup