Message 1 of 3
Why does the locked layers not fading with vba?
Not applicable
12-29-2012
07:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have this application:
It's a userform with a combobox filled up with all layers. There also are 2 commandbuttons and a label.
When I apply the command button all the layers except the selected layer in the combobox lock. That's good.
This is the problem:
Normaly when I lock a layer it is fading (laylockfadectl 80). But when I lock layers with this vba code it doesn't fading locked layers. Can someone help?
gr. laszlo
Option Explicit Private Sub cmbx1_Change() Label1.Caption = cmbx1.Value End Sub Private Sub cmdAPPLY_Click() On Error Resume Next 'handle exceptions inline
Dim objlayers As AcadLayers Dim objlayer As AcadLayer
Set objlayers = ThisDrawing.Layers 'make the layer selected in the combobox current ThisDrawing.ActiveLayer = objlayers.Item(cmbx1.Text) For Each objlayer In objlayers objlayer.Lock = True 'lock all the layers Next objlayer Set objlayer = objlayers.Item(cmbx1.Text) If objlayer Is Nothing Then MsgBox "layer does not exist" Exit Sub 'exit if layer not found End If objlayer.Lock = False 'unlock the desired layer End Sub Private Sub cmdEXIT_Click() Dim objlayer As AcadLayer
For Each objlayer In ThisDrawing.Layers objlayer.Lock = False Next Unload frm1 End Sub
Private Sub Label1_Click() On Error Resume Next 'handle exceptions inline Dim objlayers As AcadLayers Dim objlayer As AcadLayer
Set objlayers = ThisDrawing.Layers Me.Caption = objlayers.Item(cmbx1.Text) End Sub
Private Sub UserForm_Initialize() Dim layerColl As AcadLayers Dim objlayer As AcadLayer
'fill combobox Set layerColl = ThisDrawing.Layers For Each objlayer In layerColl cmbx1.AddItem objlayer.Name Next End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) Dim objlayer As AcadLayer
For Each objlayer In ThisDrawing.Layers objlayer.Lock = False Next End Sub