<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic VBA Insert Block from Another Drawing in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/vba-insert-block-from-another-drawing/m-p/5682231#M9598</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following method to insert autocad blocks into my drawing:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;&amp;nbsp;Set objBRef = acadDoc.ModelSpace.InsertBlock(InsertionPt, DwgBlock, XYZScale, XYZScale, XYZScale, Rotation)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The program works fine when the block I want to insert is already included in the drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to know if it is possible to insert a block from a separate drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume I replace 'DwgBlock' with the filepath/drawing.dwg I want to include but I cannot get it to work.&lt;BR /&gt;&lt;BR /&gt;Help would be greatly apreciated.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Th1nkQuick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jun 2015 06:05:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-06-18T06:05:40Z</dc:date>
    <item>
      <title>VBA Insert Block from Another Drawing</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-insert-block-from-another-drawing/m-p/5682231#M9598</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following method to insert autocad blocks into my drawing:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;&amp;nbsp;Set objBRef = acadDoc.ModelSpace.InsertBlock(InsertionPt, DwgBlock, XYZScale, XYZScale, XYZScale, Rotation)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The program works fine when the block I want to insert is already included in the drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to know if it is possible to insert a block from a separate drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume I replace 'DwgBlock' with the filepath/drawing.dwg I want to include but I cannot get it to work.&lt;BR /&gt;&lt;BR /&gt;Help would be greatly apreciated.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Th1nkQuick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 06:05:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-insert-block-from-another-drawing/m-p/5682231#M9598</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-18T06:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Insert Block from Another Drawing</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-insert-block-from-another-drawing/m-p/5682853#M9599</link>
      <description>&lt;P&gt;The method will only insert another dwg as a block. It will not find blocks defined in the external file. What you would have to do is first insert the external file and then delete the insert. This will bring in block def's, text and dim styles, etc. Then you can just insert the block by its name.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 14:42:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-insert-block-from-another-drawing/m-p/5682853#M9599</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2015-06-18T14:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Insert Block from Another Drawing</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-insert-block-from-another-drawing/m-p/5686998#M9600</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@eljobe wrote:&lt;BR /&gt;&lt;P&gt;The method will only insert another dwg as a block. It will not find blocks defined in the external file. What you would have to do is first insert the external file and then delete the insert. This will bring in block def's, text and dim styles, etc. Then you can just insert the block by its name.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thank you eljobe. I have solved my issue after following your advice.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2015 03:16:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-insert-block-from-another-drawing/m-p/5686998#M9600</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-22T03:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Insert Block from Another Drawing</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-insert-block-from-another-drawing/m-p/10138586#M9601</link>
      <description>&lt;P&gt;&lt;BR /&gt;Sub Sub4001_InsertTBLibrary()&lt;BR /&gt;'(VBA AutoCad) Insert TuanBui Library,[ITBL]&lt;/P&gt;&lt;P&gt;'Define Library FilePath&lt;BR /&gt;Dim Folder As String&lt;BR /&gt;Dim Filename As String&lt;BR /&gt;Dim FilePath As String&lt;BR /&gt;Folder = "C:\Users\buian\Desktop\TEST BRICS\02-INSERT NOTE"&lt;BR /&gt;Filename = "00-TBLIBRARY.dwg"&lt;BR /&gt;FilePath = Folder &amp;amp; "\" &amp;amp; Filename&lt;BR /&gt;&lt;BR /&gt;'Check Exists file&lt;BR /&gt;Dim FSO As Object&lt;BR /&gt;Set FSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;If FSO.fileExists(FilePath) Then 'kiem tra trong thu muc co ton tai file k&lt;BR /&gt;Set FSO = Nothing&lt;BR /&gt;Else&lt;BR /&gt;Set FSO = Nothing&lt;BR /&gt;MsgBox "Please check File Path"&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;'Insert&lt;BR /&gt;Dim ScaleMode As String: ScaleMode = "Scale"&lt;BR /&gt;'"Automatic","SelectPoint","Point00","DrawingOutside"&lt;BR /&gt;Dim InsertPointMode As String: InsertPointMode = "DrawingOutside"&lt;BR /&gt;Dim StrInsertPointX As Double&lt;BR /&gt;Dim StrInsertPointY As Double&lt;BR /&gt;Dim RotateAngle As Double&lt;BR /&gt;Dim DeleteExplode As String: DeleteExplode = "Explode"&lt;BR /&gt;'Define Pathname and blockname&lt;BR /&gt;Dim ExternalBlockname As String&lt;BR /&gt;ExternalBlockname = "UpdateBlock" &amp;amp; Func31HourMinute&lt;BR /&gt;Call HCF4003_InsertExternalDrawing(Thisdrawing, FilePath, ExternalBlockname, ScaleMode, InsertPointMode, StrInsertPointX, StrInsertPointY, RotateAngle, DeleteExplode)&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Sub Sub4002_A_InsertSurfaceTexture0()&lt;BR /&gt;'(VBA AutoCad) Insert Surface Texture Ra0,[RA0]&lt;/P&gt;&lt;P&gt;Dim BeginBlockname As String: BeginBlockname = "RA0_"&lt;BR /&gt;Call Func5012_InsertSurfaceTexture(BeginBlockname)&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;Sub Sub4002_B_InsertSurfaceTexture25()&lt;BR /&gt;'(VBA AutoCad) Insert Surface Texture Ra25,[RA25]&lt;/P&gt;&lt;P&gt;Dim BeginBlockname As String: BeginBlockname = "RA25_"&lt;BR /&gt;Call Func5012_InsertSurfaceTexture(BeginBlockname)&lt;/P&gt;&lt;P&gt;End Sub&lt;BR /&gt;Sub Sub4002_C_InsertSurfaceTexture125()&lt;BR /&gt;'(VBA AutoCad) Insert Surface Texture Ra125,[RA125]&lt;/P&gt;&lt;P&gt;Dim BeginBlockname As String: BeginBlockname = "RA125_"&lt;BR /&gt;Call Func5012_InsertSurfaceTexture(BeginBlockname)&lt;/P&gt;&lt;P&gt;End Sub&lt;BR /&gt;Sub Sub4002_D_InsertSurfaceTexture63()&lt;BR /&gt;'(VBA AutoCad) Insert Surface Texture Ra63,[RA63]&lt;/P&gt;&lt;P&gt;Dim BeginBlockname As String: BeginBlockname = "RA63_"&lt;BR /&gt;Call Func5012_InsertSurfaceTexture(BeginBlockname)&lt;/P&gt;&lt;P&gt;End Sub&lt;BR /&gt;Sub Sub4002_E_InsertSurfaceTexture32()&lt;BR /&gt;'(VBA AutoCad) Insert Surface Texture Ra32,[RA32]&lt;/P&gt;&lt;P&gt;Dim BeginBlockname As String: BeginBlockname = "RA32_"&lt;BR /&gt;Call Func5012_InsertSurfaceTexture(BeginBlockname)&lt;/P&gt;&lt;P&gt;End Sub&lt;BR /&gt;Sub Sub4002_F_InsertSurfaceTexture16()&lt;BR /&gt;'(VBA AutoCad) Insert Surface Texture Ra16,[RA16]&lt;/P&gt;&lt;P&gt;Dim BeginBlockname As String: BeginBlockname = "RA16_"&lt;BR /&gt;Call Func5012_InsertSurfaceTexture(BeginBlockname)&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;BR /&gt;';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;BR /&gt;Function Func5011_GetInsertPointAndDirectionPoint() As Variant&lt;/P&gt;&lt;P&gt;'Select Insert Point and Direction Point&lt;BR /&gt;Dim InsertPoint As Variant&lt;BR /&gt;Dim DirectionPoint As Variant&lt;BR /&gt;Dim Result(0 To 1) As Variant&lt;BR /&gt;&lt;BR /&gt;On Error GoTo Step1&lt;BR /&gt;InsertPoint = Thisdrawing.Utility.GetPoint(, "Select InsertPoint:")&lt;BR /&gt;DirectionPoint = Thisdrawing.Utility.GetPoint(InsertPoint, "Select DirectionPoint:")&lt;BR /&gt;Step1:&lt;BR /&gt;If Err Then&lt;BR /&gt;Result(0) = False&lt;BR /&gt;Func5011_GetInsertPointAndDirectionPoint = False&lt;BR /&gt;Else&lt;BR /&gt;Result(0) = InsertPoint&lt;BR /&gt;Result(1) = DirectionPoint&lt;BR /&gt;Func5011_GetInsertPointAndDirectionPoint = Result&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;End Function&lt;/P&gt;&lt;P&gt;Function Func5012_InsertSurfaceTexture(BeginBlockname As String)&lt;/P&gt;&lt;P&gt;'Get Dimscale and Define BlockScale&lt;BR /&gt;Dim DimScale As Integer&lt;BR /&gt;DimScale = Thisdrawing.GetVariable("DIMSCALE")&lt;/P&gt;&lt;P&gt;'Othor On&lt;BR /&gt;Thisdrawing.SetVariable "ORTHOMODE", 1&lt;/P&gt;&lt;P&gt;'Set UCS is World UCS&lt;BR /&gt;Dim Point00(0 To 2) As Double&lt;BR /&gt;Call FuncCadHome05SetUCSFromPoint(Point00)&lt;/P&gt;&lt;P&gt;'Select Insert Point and Direction Point and insert block&lt;BR /&gt;Dim Get2Point As Variant&lt;BR /&gt;Dim InsertPoint As Variant&lt;BR /&gt;Dim DirectionPoint As Variant&lt;BR /&gt;Do&lt;BR /&gt;Get2Point = Func5011_GetInsertPointAndDirectionPoint&lt;BR /&gt;If VarType(Get2Point) = vbBoolean Then Exit Function&lt;BR /&gt;InsertPoint = Get2Point(0)&lt;BR /&gt;DirectionPoint = Get2Point(1)&lt;BR /&gt;Call Func5012_A_InsertSurfaceTexture(BeginBlockname, DimScale, InsertPoint, DirectionPoint)&lt;BR /&gt;Loop While VarType(Get2Point) &amp;lt;&amp;gt; vbBoolean&lt;/P&gt;&lt;P&gt;End Function&lt;BR /&gt;Function Func5012_A_InsertSurfaceTexture(BeginBlockname As String, DimScale As Integer, InsertPoint As Variant, DirectionPoint As Variant)&lt;/P&gt;&lt;P&gt;'Dim&lt;BR /&gt;Dim ObjBlockRef As AcadBlockReference&lt;BR /&gt;Dim XScale As Integer&lt;BR /&gt;Dim YScale As Integer&lt;BR /&gt;Dim ZScale As Integer&lt;BR /&gt;Dim RotationAngle As Double&lt;BR /&gt;Dim Blockname As String&lt;BR /&gt;Dim EndBlockname As String&lt;BR /&gt;&lt;BR /&gt;'Get Dimscale and Define BlockScale&lt;BR /&gt;XScale = DimScale&lt;BR /&gt;YScale = DimScale&lt;BR /&gt;ZScale = DimScale&lt;BR /&gt;&lt;BR /&gt;'Define Blockname&lt;BR /&gt;Dim InsertPointX As Double&lt;BR /&gt;Dim InsertPointY As Double&lt;BR /&gt;Dim DirectionPointX As Double&lt;BR /&gt;Dim DirectionPointY As Double&lt;BR /&gt;InsertPointX = Round(InsertPoint(0), 2)&lt;BR /&gt;InsertPointY = Round(InsertPoint(1), 2)&lt;BR /&gt;DirectionPointX = Round(DirectionPoint(0), 2)&lt;BR /&gt;DirectionPointY = Round(DirectionPoint(1), 2)&lt;BR /&gt;If InsertPointX = DirectionPointX Then&lt;BR /&gt;'90,270&lt;BR /&gt;If DirectionPointY &amp;gt; InsertPointY Then&lt;BR /&gt;EndBlockname = "90"&lt;BR /&gt;Else&lt;BR /&gt;EndBlockname = "270"&lt;BR /&gt;End If&lt;BR /&gt;Else&lt;BR /&gt;'0,180&lt;BR /&gt;If DirectionPointX &amp;gt; InsertPointX Then&lt;BR /&gt;EndBlockname = "0"&lt;BR /&gt;Else&lt;BR /&gt;EndBlockname = "180"&lt;BR /&gt;End If&lt;BR /&gt;End If&lt;BR /&gt;Blockname = BeginBlockname &amp;amp; EndBlockname&lt;BR /&gt;Set ObjBlockRef = Thisdrawing.ModelSpace.InsertBlock(InsertPoint, Blockname, XScale, YScale, ZScale, RotationAngle)&lt;/P&gt;&lt;P&gt;'Explode Block Reference&lt;BR /&gt;Dim ExplodeArr As Variant&lt;BR /&gt;ExplodeArr = ObjBlockRef.Explode&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Function HCF4003_InsertExternalDrawing(Thisdrawing As AcadDocument, FilePath As String, Blockname As String, ScaleMode As String, InsertPointMode As String, StrInsertPointX As Variant, StrInsertPointY As Variant, RotateAngle As Double, DeleteExplode As String)&lt;/P&gt;&lt;P&gt;'Define PageSize&lt;BR /&gt;Dim TitleBlock As AcadBlockReference&lt;BR /&gt;Set TitleBlock = HCF4004_GetPartPropertyBlockRef(Thisdrawing)&lt;BR /&gt;Dim PaperSize As String&lt;BR /&gt;PaperSize = HCF4005_GetAttValueOfPartPropertyBlockRef(Thisdrawing, TitleBlock, "&amp;#144;}–ÊƒTƒCƒY")&lt;/P&gt;&lt;P&gt;'Define InsertBlockScale from Dimscale and ScaleMode&lt;BR /&gt;Dim InsertBlockScale As Integer&lt;BR /&gt;InsertBlockScale = HCF4003_A_DefineInsertBlockScale(Thisdrawing, ScaleMode)&lt;/P&gt;&lt;P&gt;'Define InsertPoint&lt;BR /&gt;Dim InsertPoint As Variant&lt;BR /&gt;InsertPoint = HCF4003_B_DefineInsertPoint(Thisdrawing, PaperSize, InsertPointMode, StrInsertPointX, StrInsertPointY, InsertBlockScale)&lt;/P&gt;&lt;P&gt;'Define InsertPoint from PageSize,InsertPointMode,DimScale&lt;BR /&gt;Call HCF4003_C_InsertExternalDrawing(Thisdrawing, FilePath, Blockname, InsertPoint, InsertBlockScale, RotateAngle, DeleteExplode)&lt;/P&gt;&lt;P&gt;End Function&lt;BR /&gt;Function HCF4004_GetPartPropertyBlockRef(Thisdrawing As AcadDocument) As AcadBlockReference&lt;/P&gt;&lt;P&gt;'Call Function Unlock layer Frame&lt;BR /&gt;Call Func06UnlockLayer(Thisdrawing, FrameLayerName)&lt;BR /&gt;Dim ObjAttBlock As AcadSelectionSet&lt;BR /&gt;Set ObjAttBlock = Thisdrawing.SelectionSets.Add("objAttBlock" &amp;amp; Now)&lt;BR /&gt;Dim FT(3) As Integer&lt;BR /&gt;Dim FD(3) As Variant&lt;BR /&gt;FT(0) = -4: FD(0) = "&amp;lt;AND"&lt;BR /&gt;FT(1) = 0: FD(1) = "INSERT"&lt;BR /&gt;FT(2) = 2: FD(2) = PartPropertyBlock&lt;BR /&gt;FT(3) = -4: FD(3) = "AND&amp;gt;"&lt;BR /&gt;ObjAttBlock.Select acSelectionSetAll, , , FT, FD&lt;BR /&gt;If ObjAttBlock.Count = 0 Then&lt;BR /&gt;ObjAttBlock.Delete&lt;BR /&gt;Exit Function&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;Dim TitleBlock As AcadBlockReference&lt;BR /&gt;For Each TitleBlock In ObjAttBlock&lt;BR /&gt;Set HCF4004_GetPartPropertyBlockRef = TitleBlock&lt;BR /&gt;Next&lt;BR /&gt;ObjAttBlock.Delete&lt;BR /&gt;'Call Function Lock Layer Frame&lt;BR /&gt;Call Func07LockLayer(Thisdrawing, FrameLayerName)&lt;/P&gt;&lt;P&gt;End Function&lt;BR /&gt;Function HCF4005_GetAttValueOfPartPropertyBlockRef(Thisdrawing As AcadDocument, TitleBlock As AcadBlockReference, TagName As String) As String&lt;/P&gt;&lt;P&gt;'Call Function Unlock layer Frame&lt;BR /&gt;Call Func06UnlockLayer(Thisdrawing, FrameLayerName)&lt;/P&gt;&lt;P&gt;If TitleBlock Is Nothing Then&lt;BR /&gt;Exit Function&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;Dim varAttributes As Variant&lt;BR /&gt;Dim AttTextString As String&lt;/P&gt;&lt;P&gt;varAttributes = TitleBlock.GetAttributes&lt;BR /&gt;For i = LBound(varAttributes) To UBound(varAttributes)&lt;BR /&gt;If varAttributes(i).TagString = TagName Then&lt;BR /&gt;AttTextString = varAttributes(i).TextString&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;'Call Function Lock Layer Frame&lt;BR /&gt;Call Func07LockLayer(Thisdrawing, FrameLayerName)&lt;BR /&gt;HCF4005_GetAttValueOfPartPropertyBlockRef = AttTextString&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;P&gt;Function HCF4003_A_DefineInsertBlockScale(Thisdrawing As AcadDocument, ScaleMode As String) As Integer&lt;BR /&gt;'Define InsertBlockScale from Dimscale and ScaleMode&lt;BR /&gt;Dim InsertBlockScale As Integer&lt;BR /&gt;Dim DimScale As Integer&lt;BR /&gt;DimScale = Thisdrawing.GetVariable("DIMSCALE")&lt;BR /&gt;Select Case ScaleMode&lt;BR /&gt;Case "Scale"&lt;BR /&gt;InsertBlockScale = DimScale&lt;BR /&gt;Case "NoScale"&lt;BR /&gt;InsertBlockScale = 1&lt;BR /&gt;Case Else&lt;BR /&gt;InsertBlockScale = 1&lt;BR /&gt;End Select&lt;BR /&gt;HCF4003_A_DefineInsertBlockScale = InsertBlockScale&lt;BR /&gt;End Function&lt;BR /&gt;Function HCF4003_B_DefineInsertPoint(Thisdrawing As AcadDocument, PaperSize As String, InsertPointMode As String, StrInsertPointX As Variant, StrInsertPointY As Variant, InsertBlockScale As Integer) As Variant&lt;/P&gt;&lt;P&gt;'Define InsertPointMode from Excel&lt;BR /&gt;Select Case InsertPointMode&lt;BR /&gt;Case "Automatic"&lt;BR /&gt;If VarType(StrInsertPointX) &amp;lt;&amp;gt; vbDouble Or VarType(StrInsertPointY) &amp;lt;&amp;gt; vbDouble Then&lt;BR /&gt;InsertPointMode = "SelectPoint"&lt;BR /&gt;End If&lt;BR /&gt;Select Case PaperSize&lt;BR /&gt;Case "A4"&lt;BR /&gt;Case "A3"&lt;BR /&gt;Case "A2"&lt;BR /&gt;Case Else&lt;BR /&gt;InsertPointMode = "SelectPoint"&lt;BR /&gt;End Select&lt;BR /&gt;Case "SelectPoint"&lt;BR /&gt;Case "Point00"&lt;BR /&gt;Case "DrawingOutside"&lt;BR /&gt;If PaperSize = "" Then InsertPointMode = "SelectPoint"&lt;BR /&gt;Case Else&lt;BR /&gt;InsertPointMode = "SelectPoint"&lt;BR /&gt;End Select&lt;/P&gt;&lt;P&gt;'Define InsertPoint&lt;BR /&gt;Dim BasicInsertPoint(0 To 2) As Double&lt;BR /&gt;Dim AfterInsertPoint(0 To 2) As Double&lt;BR /&gt;Dim SelectPoint As Variant&lt;BR /&gt;Select Case InsertPointMode&lt;BR /&gt;Case "Automatic"&lt;BR /&gt;AfterInsertPoint(0) = CDbl(StrInsertPointX) * InsertBlockScale&lt;BR /&gt;AfterInsertPoint(1) = CDbl(StrInsertPointY) * InsertBlockScale&lt;BR /&gt;Case "SelectPoint"&lt;BR /&gt;On Error GoTo next01&lt;BR /&gt;SelectPoint = Thisdrawing.Utility.GetPoint(, "Select Insert Point:")&lt;BR /&gt;AfterInsertPoint(0) = SelectPoint(0)&lt;BR /&gt;AfterInsertPoint(1) = SelectPoint(1)&lt;BR /&gt;next01:&lt;BR /&gt;If Err Then GoTo next02&lt;BR /&gt;Case "DrawingOutside"&lt;BR /&gt;next02:&lt;BR /&gt;Select Case PaperSize&lt;BR /&gt;Case "A4"&lt;BR /&gt;AfterInsertPoint(0) = A4X11 * InsertBlockScale&lt;BR /&gt;Case "A3"&lt;BR /&gt;AfterInsertPoint(0) = A3X11 * InsertBlockScale&lt;BR /&gt;Case "A2"&lt;BR /&gt;AfterInsertPoint(0) = A2X11 * InsertBlockScale&lt;BR /&gt;End Select&lt;BR /&gt;Case "Point00"&lt;BR /&gt;AfterInsertPoint(0) = 0&lt;BR /&gt;AfterInsertPoint(1) = 0&lt;BR /&gt;End Select&lt;/P&gt;&lt;P&gt;HCF4003_B_DefineInsertPoint = AfterInsertPoint&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;P&gt;Function HCF4003_C_InsertExternalDrawing(Thisdrawing As AcadDocument, Pathname As String, Blockname As String, InsertPoint As Variant, InsertBlockScale As Integer, RotateAngle As Double, DeleteExplodeMode As String)&lt;BR /&gt;'Mode(Delete,Explode,Block)&lt;BR /&gt;'Add External Reference&lt;BR /&gt;Dim ObjExternalReference As AcadExternalReference&lt;BR /&gt;Dim XScale As Integer&lt;BR /&gt;Dim YScale As Integer&lt;BR /&gt;Dim ZScale As Integer&lt;BR /&gt;Dim Overlay As Boolean: Overlay = False&lt;/P&gt;&lt;P&gt;'Define XScale,YScale,ZScale&lt;BR /&gt;XScale = InsertBlockScale&lt;BR /&gt;YScale = InsertBlockScale&lt;BR /&gt;ZScale = InsertBlockScale&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;'Attach ObjExternalReference&lt;BR /&gt;Set ObjExternalReference = Thisdrawing.ModelSpace.AttachExternalReference(Pathname, Blockname, InsertPoint, XScale, YScale, ZScale, RotateAngle, False)&lt;BR /&gt;Thisdrawing.Blocks.Item(ObjExternalReference.Name).Bind True&lt;/P&gt;&lt;P&gt;'Explode Block,DeleteBlock&lt;BR /&gt;Dim ObjSelectSet As AcadSelectionSet&lt;BR /&gt;Dim EachObj As AcadEntity&lt;BR /&gt;Dim ObjBlockRef As AcadBlockReference&lt;BR /&gt;Dim ObjBlock As AcadBlock&lt;BR /&gt;Set ObjSelectSet = Thisdrawing.SelectionSets.Add("ObjSelectSet" &amp;amp; Now)&lt;BR /&gt;Dim FT(3) As Integer&lt;BR /&gt;Dim FD(3) As Variant&lt;BR /&gt;FT(0) = -4: FD(0) = "&amp;lt;AND"&lt;BR /&gt;FT(1) = 0: FD(1) = "INSERT"&lt;BR /&gt;FT(2) = 2: FD(2) = Blockname&lt;BR /&gt;FT(3) = -4: FD(3) = "AND&amp;gt;"&lt;BR /&gt;ObjSelectSet.Select acSelectionSetAll, , , FT, FD&lt;BR /&gt;Set ObjBlockRef = ObjSelectSet.Item(0)&lt;BR /&gt;ObjSelectSet.Delete&lt;BR /&gt;Select Case DeleteExplodeMode&lt;BR /&gt;Case "Delete"&lt;BR /&gt;ObjBlockRef.Delete&lt;BR /&gt;Set ObjBlock = Thisdrawing.Blocks(Blockname)&lt;BR /&gt;ObjBlock.Delete&lt;BR /&gt;Case "Explode"&lt;BR /&gt;'Explode&lt;BR /&gt;Call HCF4007_ExplodeBlockReference(Thisdrawing, ObjBlockRef)&lt;BR /&gt;Set ObjBlock = Thisdrawing.Blocks(Blockname)&lt;BR /&gt;ObjBlock.Delete&lt;BR /&gt;Case "DeleteBlockRef"&lt;BR /&gt;ObjBlockRef.Delete&lt;BR /&gt;Case Else&lt;BR /&gt;End Select&lt;/P&gt;&lt;P&gt;End Function&lt;BR /&gt;';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;BR /&gt;';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;BR /&gt;Public Const LibraryPath As String = "C:\Users\buian\Desktop\TEST BRICS\TBLibrary"&lt;BR /&gt;'PageSize&lt;BR /&gt;Public Const A4X11 As Integer = 210&lt;BR /&gt;Public Const A3X11 As Integer = 420&lt;BR /&gt;Public Const A2X11 As Integer = 594&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 12:31:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-insert-block-from-another-drawing/m-p/10138586#M9601</guid>
      <dc:creator>buianhtuan.cdt</dc:creator>
      <dc:date>2021-03-08T12:31:44Z</dc:date>
    </item>
  </channel>
</rss>

