I couldn't find it so I did it again really quickly. This is less elegant than it could be because I did some quick cribbing and patching from other things. It will also only work on modelspace xrefs. If it hits a pspace xref it will detach it and reattach in mspace. I've been told before that I shouldn't post any code unless it's fully tested and bulletproof because I'm wasting the persons time if they have to actually put any effort into it themselves, but this is not tested. It should work. If it doesn't, it will with minor tweaking.
Public Sub Layover()
Dim objSelSets As AcadSelectionSets
Dim objSelSet As AcadSelectionSet
Dim objOverlay As AcadExternalReference
Dim intType(0) As Integer
Dim varData(0) As Variant
Dim strPath As String
Dim strName As String
Dim dblInsPnt(0 To 2) As Double
Dim objXref As AcadExternalReference
Dim objEnt As AcadEntity
Dim objBlk As AcadBlock
Dim objBlks As AcadBlocks
Set objBlks = ThisDrawing.Blocks
Set objSelSets = ThisDrawing.SelectionSets
For Each objSelSet In objSelSets
If objSelSet.Name = "GetXrefs" Then
objSelSets.Item("GetXrefs").Delete
Exit For
End If
Next
Set objSelSet = objSelSets.Add("GetXrefs")
intType(0) = 0
varData(0) = "INSERT"
objSelSet.Select 5, filtertype:=intType, filterdata:=varData
For Each objEnt In objSelSet
Set objBlk = objBlks(objEnt.Name)
If objBlk.IsXRef Then
Set objXref = objEnt
strName = obxref.Name
strPath = objXref.Path
dblInsPt = objXref.InsertionPoint
objBlk.Detach
Set objOverlay = ModelSpace.AttachExternalReference(strPath, strName, dblInsPnt, 1, 1, 1, 1, True)
End If
Next objEnt
End Sub