Message 1 of 12
Insert block Error "Key not found"
Not applicable
07-25-2008
07:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
ACAD 2000i
I am trying to insert a block using this code:
'OLE Automation Object Calls
Set AcadObj = GetObject(, "AutoCAD.Application")
Set ThisDrawing = AcadObj.ActiveDocument
Dim insertionPnt(0 To 2) As Double
Dim blockObj As AcadBlock
' specify insertion points
insertionPnt(0) = 0
insertionPnt(1) = 0
insertionPnt(2) = 0
Dim docName, JobBlockName As String
docName = ThisDrawing.FullName
JobBlockName = "C:/Program Files/AutoCAD LT 2000/Sample PointTB.dwg"
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, JobBlockName, 1#, 1#, 1#, 0)
' Get the attributes for the block reference
Dim varAttributes As Variant
varAttributes = blockRefObj.GetAttributes
' Change the value of the attribute
' Note: There is no SetAttributes. Once you have the variant array, you have the objects.
' Changing them changes the objects in the drawing.
varAttributes(0).TextString = Me![ChainOfCustody Details subform].Form.SampleNum
Set AcadObj = Nothing
---------------
Error is on Set blockRefObj = ThisDrawing.ModelSpace...
Any Ideas
TIA
I am trying to insert a block using this code:
'OLE Automation Object Calls
Set AcadObj = GetObject(, "AutoCAD.Application")
Set ThisDrawing = AcadObj.ActiveDocument
Dim insertionPnt(0 To 2) As Double
Dim blockObj As AcadBlock
' specify insertion points
insertionPnt(0) = 0
insertionPnt(1) = 0
insertionPnt(2) = 0
Dim docName, JobBlockName As String
docName = ThisDrawing.FullName
JobBlockName = "C:/Program Files/AutoCAD LT 2000/Sample PointTB.dwg"
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, JobBlockName, 1#, 1#, 1#, 0)
' Get the attributes for the block reference
Dim varAttributes As Variant
varAttributes = blockRefObj.GetAttributes
' Change the value of the attribute
' Note: There is no SetAttributes. Once you have the variant array, you have the objects.
' Changing them changes the objects in the drawing.
varAttributes(0).TextString = Me![ChainOfCustody Details subform].Form.SampleNum
Set AcadObj = Nothing
---------------
Error is on Set blockRefObj = ThisDrawing.ModelSpace...
Any Ideas
TIA