Using VB program to insert AutoCAD block
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Currently using AutoCAD 2010
Inside VB, under references I have selected AutoCAD 2010 Type Library and AutoCAD/ObjectDBX Common 18.0 Library.
I created a titleblock insertion program for our projects which has been working fine in AutoCAD 2008
Part of code where it crashes:
Public Sub InsertBorder(DwgBlock As String)
Dim Inspt(0 To 2) As Double
Dim XYZScale As Double
Dim Rotation As Double
Dim varAttribute As Variant
Inspt(0) = 0
Inspt(1) = 0
Inspt(2) = 0
XYZScale = 1
Rotation = 0
'set border layer to SHEET01
Set objCurrentLayer = acadDoc.Layers.Add("SHEET01")
acadDoc.ActiveLayer = objCurrentLayer
;code crashes on the next line. In Debug mode, I discovered that the variable Inspt has no value, all other variables are
Set objBRef = acadDoc.ModelSpace.InsertBlock(Inspt, DwgBlock, XYZScale, XYZScale, XYZScale, Rotation)
Any suggestions will be greatly appreciated. I am guessing there is a change with AutoCAD 2010, but hell if I can find it.