Here is the module
Option Explicit
Public Sub eppictitl()
Dim SysvarName As String
Dim intdata As Long, OBJvp As AcadPViewport
Dim strData As String, inst(0 To 2) As Double, MIDPT(0 To 2) As Double
Dim X As Double, Y As Double
ThisDrawing.ActiveSpace = acPaperSpace
inst(0) = 0: inst(1) = 0: inst(2) = 0
MIDPT(0) = 16.96367147: MIDPT(1) = 12: MIDPT(2) = 0
X = 33.0473
Y = 23.1
ThisDrawing.ActiveLayer = ThisDrawing.Layers.Add("ANNO-TITL")
ThisDrawing.Layers.Item("ANNO-TITL").color = 8
SysvarName = "FILEDIA"
intdata = 1
ThisDrawing.SetVariable SysvarName, intdata
SysvarName = "CMDDIA"
intdata = 1
ThisDrawing.SetVariable SysvarName, intdata
SysvarName = "PROJECTNAME"
strData = "."
ThisDrawing.SetVariable SysvarName, strData
SysvarName = "snapmode"
intdata = "0"
ThisDrawing.SetVariable SysvarName, intdata
SysvarName = "cecolor"
strData = "bylayer"
ThisDrawing.SetVariable SysvarName, strData
SysvarName = "CELTYPE"
strData = "bylayer"
ThisDrawing.SetVariable SysvarName, strData
SysvarName = "CELWEIGHT"
intdata = "-1"
ThisDrawing.SetVariable SysvarName, intdata
ThisDrawing.PaperSpace.AttachExternalReference "u:\titleblocks\pp-vtep.dwg", "pp-vtep", inst, 1, 1, 1, 0, False
Set OBJvp = ThisDrawing.PaperSpace.AddPViewport(MIDPT, X, Y)
OBJvp.Display True
ThisDrawing.Regen acAllViewports
ThisDrawing.MSpace = True
ZoomExtents
ThisDrawing.MSpace = False
ZoomExtents
ThisDrawing.PaperSpace.InsertBlock inst, "PP-VTITLINFO.DWG", 1, 1, 1, 0
ThisDrawing.Regen acAllViewports
ThisDrawing.Save
End Sub
Like you, I have never had any problems inserting blocks until now. When I step through the code using F8, or when I have it break on error, it always highlights that line. It also only crashes when there is more than 1 dwg open.
I told autodesk about the problem, and they were able to repeat the problem if they had more than 1 dwg open. They have esculated it to developement to see what is going on.