Can anyone tell my why I would be getting the attached error message when trying to run my code below? The error occurs on the second pass through the loop when the first block is supposed to be inserted.
Sub NewDrawings()
Dim i As Integer
Dim docObj As AcadDocument
Dim blockRefObj As AcadBlockReference
Dim insertionPnt(0 To 2) As Double
Dim file As String
Dim border As String
Dim bom As String
border = "S:\Templates Active\_AECL CRL\D Border.dwg"
bom = "S:\Templates Active\_AECL CRL\BOM Table.dwg"
For i = 0 To 2
file = "c:\Cable Project\cable - " & i
Set docObj = ThisDrawing.Application.Documents.Add("S:\Templates Active\acad electrical.dwt")
insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, border, 1#, 1#, 1#, 0)
insertionPnt(0) = 33.0172: insertionPnt(1) = 21.3085: insertionPnt(2) = 0#
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, bom, 1#, 1#, 1#, 0)
blockRefObj.Explode 'explode the block
blockRefObj.Delete
ZoomExtents
ThisDrawing.SaveAs (file)
ThisDrawing.Close
Next i
End Sub
Any help would be great . . . I've been banging my head against the wall on this one for a while. Thanks,
Nathan