This code works fine.
Now I wants a different layer zb. layer03 to be highlight (false). How to combine this in the same code?
gr. Laszlo
Public Sub HighlightTest()
Dim tSelSet As AcadSelectionSet
Set tSelSet = getSelSetByLayer("Layer01")
If tSelSet Is Nothing Then
MsgBox ("No Selectionset")
ElseIf tSelSet.Count = 0 Then
MsgBox ("No objects found on Layer 'Layer01'")
Else
Dim tEnt As AcadEntity
For Each tEnt In tSelSet
tEnt.Highlight (True)
Next
End If
End Sub
Private Function getSelSetByLayer(ByVal LayerName As String) As AcadSelectionSet
Dim tRetVal As AcadSelectionSet
On Error Resume Next
'create selectionset
Set tRetVal = ThisDrawing.SelectionSets.Add("mySelSet")
If tRetVal Is Nothing Then Set tRetVal = ThisDrawing.SelectionSets.Item("mySelSet")
'create filter for selection
Dim tDxfCodes(0) As Integer: tDxfCodes(0) = 8 '8=dxfcode for "layername"
Dim tDxfValues(0) As Variant: tDxfValues(0) = LayerName
'select
tRetVal.Clear
Call tRetVal.Select(acSelectionSetAll, , , tDxfCodes, tDxfValues)
'return
Set getSelSetByLayer = tRetVal
End Function