I am trying to detatch all xrefs in the current drawing. I am using the following code but I am getting an error. The error I get is an Automation error - Unspecified Error. This code will detach one xref. I think the error happens when the program hits the last block in curBlock. When I hit debug it highlights the line "Next curBlock". Can anyone tell me how to get around this, or provide different code to get this done. Thanks in advance, Pat Dim curBlock As AcadBlock Dim myBlocks As AcadBlocks Set myBlocks = ThisDrawing.Blocks For Each curBlock In myBlocks If curBlock.IsXRef Then Debug.Print curBlock.name curBlock.Detach End If Next curBlock