Computer Aided Automation
How to insert external drawing as block using AutoCAD VBA - Printable Version

+- Computer Aided Automation (https://www.computeraidedautomation.com)
+-- Forum: VBA Programming (https://www.computeraidedautomation.com/forumdisplay.php?fid=1)
+--- Forum: AutoCAD VBA (https://www.computeraidedautomation.com/forumdisplay.php?fid=2)
+--- Thread: How to insert external drawing as block using AutoCAD VBA (/showthread.php?tid=1)



How to insert external drawing as block using AutoCAD VBA - CAA - 07-25-2019

use below code to insert a different drawing file as block inside a cad drawing - using AutoCAD VBA

Sub CAAinsertblock()
  Dim FileToInsert As String
  Dim BlockRef14 As AcadBlockReference
  Dim insertionPnt4(0 To 2) As Double
  insertionPnt4(0) = DRGX#: insertionPnt4(1) = DRGY#: insertionPnt4(2) = 0#
  FileToInsert = "C:\DWG\CAA\file-to-be-inserted.dwg"
  Set BlockRef14 = ThisDrawing.ModelSpace.InsertBlock(insertionPnt4, FileToInsert, 1#, 1#, 1#, 0)
  'ZoomAll
End Sub