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
Comments