Here's some stuff from a thingy. The code as it is here is used to get paths of xrefs, but shows a method for drilling in looking for nested xrefs. Let me know if you need help putting it together.
Private Sub LoadXrefs()
Dim objSelSets As AcadSelectionSets
Dim objSelSet As AcadSelectionSet
Dim intType(0) As Integer
Dim varData(0) As Variant
Dim strPaths() As String
Dim intCnt As Integer
Dim objXref As AcadExternalReference
Dim objEnt As AcadEntity
Dim objBlk As AcadBlock
Dim objBlks As AcadBlocks
Dim intDuplicate As Integer
Dim objDuplicate As AcadEntity
Dim boolDuplicate As Boolean
Set objBlks = ThisDrawing.Blocks
Set objSelSets = ThisDrawing.SelectionSets
For Each objSelSet In objSelSets
If objSelSet.Name = "GetXrefPaths" Then
objSelSets.Item("GetXrefPaths").Delete
Exit For
End If
Next
Set objSelSet = objSelSets.Add("GetXrefPaths")
intType(0) = 0: varData(0) = "INSERT"
objSelSet.Select acSelectionSetAll, , , intType, varData
For Each objEnt In objSelSet
Set objBlk = objBlks(objEnt.Name)
If objBlk.IsXRef Then
boolDuplicate = False
For intDuplicate = 1 To colXrefs.Count
Set objDuplicate = colXrefs.Item(intDuplicate)
If objDuplicate.Name = objEnt.Name Then
boolDuplicate = True
Exit For
End If
Next intDuplicate
If boolDuplicate = False Then
colXrefs.Add objEnt '.Path
GetNested objBlk
End If
End If
Next objEnt
End Sub
Private Function GetNested(objBlk As AcadBlock) As Integer
Dim objXref As AcadExternalReference
Dim objBlkRef As AcadBlockReference
Dim objEnt As AcadEntity
Dim objNext As AcadBlock
For Each objEnt In objBlk
If TypeOf objEnt Is AcadBlockReference Then
Set objBlkRef = objEnt
Set objNext = ThisDrawing.Blocks(objBlkRef.Name)
If objNext.IsXRef Then
Set objXref = objEnt
colXrefs.Add objXref
GetNested objNext
End If
End If
Next
GetNested = colXrefs.Count
End Function
Haven't really looked at that code in a good while. I have no idea why GetNested is a function instead of a sub.
Danellis, changing xref layers changes the appearance of the objects on those layers, as long as the color/lt are set to bylayer. The same as any other object on any other layer.