Toggle all Uneditable Layers

Ease of Use


Version tested with

2005 (X3) 

Submitted by:



These procedures will turn off all layers in a CorelDraw document, storing them to an array. Then it will return the Locked layers back to locked. 


If you have borders (title blocks) in CorelDraw that are locked and you need to edit them, this could be quite useful. It lets you unlock all the Locked layers, edit what you need, then lock them again. It's much easier than to go into the Object Manager to manually unlock all the layers you need to and go back later to re-lock them. Especially if you forget which ones you've unlocked. 


instructions for use


Option Explicit Public EditLayers() As String Public LayersEditable As Boolean Public Sub ToggleLayers() ' This will unlock the layers If LayersEditable = False Then ReDim EditLayers(0) Call MakeLayersEditable(EditLayers()) LayersEditable = True Else ' Lock the layers Call MakeLayersUnEditable(EditLayers()) LayersEditable = False End If End Sub Public Sub MakeLayersUnEditable(ByRef EditLayers() As String) ' Iterate through all the layers and make them Uneditable Dim objLayer As CorelDRAW.Layer, i As Long For i = 0 To UBound(EditLayers()) If EditLayers(0) <> "" Then ' Check for an empty item ActivePage.Layers(EditLayers(i)).Editable = False End If Next End Sub Public Sub MakeLayersEditable(ByRef EditLayers() As String) ' Iterate through all the layers and make them Editable. The layers ' that are uneditable are collected in an array and they will be ' changed back later. Dim objLayer As Layer, i As Long For Each objLayer In ActivePage.Layers If objLayer.Editable = False Then ReDim Preserve EditLayers(i) EditLayers(i) = objLayer.Name objLayer.Editable = True i = i + 1 End If Next End Sub

How to use:

  1. In CorelDraw, Press Alt+F11 to open the VBE.
  2. Select your GMS (global macro storage) OR your document's project in the Project Window.
  3. Click Insert --> Module
  4. Copy code and paste in the new Module
  5. Close the VBE, return to CorelDraw
  6. Press Tools --> Visual Basic... --> Run...
  7. Select ToggleLayers

Test the code:

  1. First be sure to check if Window --> Dockers --> Object Manager is CHECKED
  2. In CorelDraw, select Tools --> Visual Basic... --> Run... --> ToggleLayers
  3. Watch the layers in the Object Manager window

Sample File: 8.94KB 

Approved by mdmackillop

This entry has been viewed 56 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express