<?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 Re: in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347306#M78668</link>
    <description>Public Sub GetXref()&lt;BR /&gt;
Dim oXref As AcadExternalReference&lt;BR /&gt;
Dim acObject As AcadObject&lt;BR /&gt;
&lt;BR /&gt;
  For Each acObject In ThisDrawing.ModelSpace&lt;BR /&gt;
    If TypeOf acObject Is AcadBlockReference Then&lt;BR /&gt;
      If ThisDrawing.Blocks(acObject.Name).IsXRef Then&lt;BR /&gt;
        Set oXref = acObject&lt;BR /&gt;
      End If&lt;BR /&gt;
    End If&lt;BR /&gt;
  Next acObject&lt;BR /&gt;
&lt;BR /&gt;
  MsgBox oXref.Path&lt;BR /&gt;
End Sub&lt;BR /&gt;
--&lt;BR /&gt;
Joe Sutphin&lt;BR /&gt;
Visual Basic How-To For AutoCAD&lt;BR /&gt;
for more book details click on the link&lt;BR /&gt;
http://eomnisource.hypermart.net</description>
    <pubDate>Mon, 17 Dec 2001 13:58:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2001-12-17T13:58:47Z</dc:date>
    <item>
      <title>modifying xrefs path and filename</title>
      <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347302#M78664</link>
      <description>I am trying to modify the xref block filename and path.  I have written a&lt;BR /&gt;
routine that will grab all blocks that are xrefs but I cannot figure out how&lt;BR /&gt;
to incorporate the externalreference object.  Every example I find loads the&lt;BR /&gt;
xref with the code.  I am trying to modify the xref path and file name of an&lt;BR /&gt;
xref that has already been loaded.  Any suggestions.&lt;BR /&gt;
&lt;BR /&gt;
Dim xref_file As AcadExternalReference&lt;BR /&gt;
For x = 0 To Me.Blocks.Count - 1&lt;BR /&gt;
    If Me.Blocks(x).IsXRef Then&lt;BR /&gt;
&lt;BR /&gt;
    'Set xref_file = Me.Blocks.Item(Me.Blocks(x).Name).Reload&lt;BR /&gt;
    'The line above is what I am having trouble with.&lt;BR /&gt;
    'I cannot figure out how to attach the object to the xref_file&lt;BR /&gt;
    'variable.&lt;BR /&gt;
&lt;BR /&gt;
    End If&lt;BR /&gt;
Next x</description>
      <pubDate>Mon, 17 Dec 2001 12:03:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347302#M78664</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-12-17T12:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: modifying xrefs path and filename</title>
      <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347303#M78665</link>
      <description>Jorge,&lt;BR /&gt;
&lt;BR /&gt;
Set xref_file = Me.Blocks.Item(x)&lt;BR /&gt;
--&lt;BR /&gt;
Joe Sutphin&lt;BR /&gt;
Visual Basic How-To For AutoCAD&lt;BR /&gt;
for more book details click on the link&lt;BR /&gt;
http://eomnisource.hypermart.net&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Jorge Aguirre" &lt;JAGUIRRE&gt; wrote in message news:90480FA55016B5A448665C6E2D85C392@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I am trying to modify the xref block filename and path.  I have written a&lt;BR /&gt;
&amp;gt; routine that will grab all blocks that are xrefs but I cannot figure out how&lt;BR /&gt;
&amp;gt; to incorporate the externalreference object.  Every example I find loads the&lt;BR /&gt;
&amp;gt; xref with the code.  I am trying to modify the xref path and file name of an&lt;BR /&gt;
&amp;gt; xref that has already been loaded.  Any suggestions.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Dim xref_file As AcadExternalReference&lt;BR /&gt;
&amp;gt; For x = 0 To Me.Blocks.Count - 1&lt;BR /&gt;
&amp;gt;     If Me.Blocks(x).IsXRef Then&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     'Set xref_file = Me.Blocks.Item(Me.Blocks(x).Name).Reload&lt;BR /&gt;
&amp;gt;     'The line above is what I am having trouble with.&lt;BR /&gt;
&amp;gt;     'I cannot figure out how to attach the object to the xref_file&lt;BR /&gt;
&amp;gt;     'variable.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt; Next x&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/JAGUIRRE&gt;</description>
      <pubDate>Mon, 17 Dec 2001 12:58:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347303#M78665</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-12-17T12:58:39Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347304#M78666</link>
      <description>I have tried this.  I get an error message, run-time error '13'  Type&lt;BR /&gt;
mismatch.&lt;BR /&gt;
&lt;BR /&gt;
Thank You for your response&lt;BR /&gt;
Jorge Aguirre&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Joe Sutphin" &lt;JOESU&gt; wrote in message&lt;BR /&gt;
news:B78BCC21DF8001E95213AC39FA18A976@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Jorge,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Set xref_file = Me.Blocks.Item(x)&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; Joe Sutphin&lt;BR /&gt;
&amp;gt; Visual Basic How-To For AutoCAD&lt;BR /&gt;
&amp;gt; for more book details click on the link&lt;BR /&gt;
&amp;gt; http://eomnisource.hypermart.net&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "Jorge Aguirre" &lt;JAGUIRRE&gt; wrote in message&lt;BR /&gt;
news:90480FA55016B5A448665C6E2D85C392@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; I am trying to modify the xref block filename and path.  I have written&lt;BR /&gt;
a&lt;BR /&gt;
&amp;gt; &amp;gt; routine that will grab all blocks that are xrefs but I cannot figure out&lt;BR /&gt;
how&lt;BR /&gt;
&amp;gt; &amp;gt; to incorporate the externalreference object.  Every example I find loads&lt;BR /&gt;
the&lt;BR /&gt;
&amp;gt; &amp;gt; xref with the code.  I am trying to modify the xref path and file name&lt;BR /&gt;
of an&lt;BR /&gt;
&amp;gt; &amp;gt; xref that has already been loaded.  Any suggestions.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Dim xref_file As AcadExternalReference&lt;BR /&gt;
&amp;gt; &amp;gt; For x = 0 To Me.Blocks.Count - 1&lt;BR /&gt;
&amp;gt; &amp;gt;     If Me.Blocks(x).IsXRef Then&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;     'Set xref_file = Me.Blocks.Item(Me.Blocks(x).Name).Reload&lt;BR /&gt;
&amp;gt; &amp;gt;     'The line above is what I am having trouble with.&lt;BR /&gt;
&amp;gt; &amp;gt;     'I cannot figure out how to attach the object to the xref_file&lt;BR /&gt;
&amp;gt; &amp;gt;     'variable.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;     End If&lt;BR /&gt;
&amp;gt; &amp;gt; Next x&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/JAGUIRRE&gt;&lt;/JOESU&gt;</description>
      <pubDate>Mon, 17 Dec 2001 13:02:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347304#M78666</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-12-17T13:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: modifying xrefs path and filename</title>
      <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347305#M78667</link>
      <description>"Jorge Aguirre" &lt;JAGUIRRE&gt; wrote in message&lt;BR /&gt;
news:90480FA55016B5A448665C6E2D85C392@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I am trying to modify the xref block filename and path.  I have written a&lt;BR /&gt;
&amp;gt; routine that will grab all blocks that are xrefs but I cannot figure out&lt;BR /&gt;
how&lt;BR /&gt;
&amp;gt; to incorporate the externalreference object.  Every example I find loads&lt;BR /&gt;
the&lt;BR /&gt;
&amp;gt; xref with the code.  I am trying to modify the xref path and file name of&lt;BR /&gt;
an&lt;BR /&gt;
&amp;gt; xref that has already been loaded.  Any suggestions.&lt;BR /&gt;
&lt;BR /&gt;
VBA does not have access to the path of an external&lt;BR /&gt;
reference, so you will have to use a third-party tool.&lt;BR /&gt;
&lt;BR /&gt;
You can visit www.caddzone.com/acadx/acadx.htm and get&lt;BR /&gt;
a copy of AcadX.arx, which provides several ways to do&lt;BR /&gt;
this (one at a time, or all at once).&lt;BR /&gt;
&lt;BR /&gt;
See the ReplaceXRefPaths() function in AcadXDatabase,&lt;BR /&gt;
or the XRefPath property of the AcadXUtility object.&lt;/JAGUIRRE&gt;</description>
      <pubDate>Mon, 17 Dec 2001 13:49:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347305#M78667</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-12-17T13:49:59Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347306#M78668</link>
      <description>Public Sub GetXref()&lt;BR /&gt;
Dim oXref As AcadExternalReference&lt;BR /&gt;
Dim acObject As AcadObject&lt;BR /&gt;
&lt;BR /&gt;
  For Each acObject In ThisDrawing.ModelSpace&lt;BR /&gt;
    If TypeOf acObject Is AcadBlockReference Then&lt;BR /&gt;
      If ThisDrawing.Blocks(acObject.Name).IsXRef Then&lt;BR /&gt;
        Set oXref = acObject&lt;BR /&gt;
      End If&lt;BR /&gt;
    End If&lt;BR /&gt;
  Next acObject&lt;BR /&gt;
&lt;BR /&gt;
  MsgBox oXref.Path&lt;BR /&gt;
End Sub&lt;BR /&gt;
--&lt;BR /&gt;
Joe Sutphin&lt;BR /&gt;
Visual Basic How-To For AutoCAD&lt;BR /&gt;
for more book details click on the link&lt;BR /&gt;
http://eomnisource.hypermart.net</description>
      <pubDate>Mon, 17 Dec 2001 13:58:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347306#M78668</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-12-17T13:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: modifying xrefs path and filename</title>
      <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347307#M78669</link>
      <description>Contrary to Tony's post, VBA can access the path of an xref just fine. The&lt;BR /&gt;
trick is getting to the xref. The attached module shows one way to do this.&lt;BR /&gt;
&lt;BR /&gt;
If your intention is to repath and reload the xref, once you've changed the&lt;BR /&gt;
xref path be sure to use the blocks collection to reload it:&lt;BR /&gt;
&lt;BR /&gt;
ThisDrawing.Blocks("x").Reload&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Good judgment comes from experience.&lt;BR /&gt;
Experience comes from bad judgment.&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Jorge Aguirre" &lt;JAGUIRRE&gt; wrote in message&lt;BR /&gt;
news:90480FA55016B5A448665C6E2D85C392@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I am trying to modify the xref block filename and path.  I have written a&lt;BR /&gt;
&amp;gt; routine that will grab all blocks that are xrefs but I cannot figure out&lt;BR /&gt;
how&lt;BR /&gt;
&amp;gt; to incorporate the externalreference object.  Every example I find loads&lt;BR /&gt;
the&lt;BR /&gt;
&amp;gt; xref with the code.  I am trying to modify the xref path and file name of&lt;BR /&gt;
an&lt;BR /&gt;
&amp;gt; xref that has already been loaded.  Any suggestions.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Dim xref_file As AcadExternalReference&lt;BR /&gt;
&amp;gt; For x = 0 To Me.Blocks.Count - 1&lt;BR /&gt;
&amp;gt;     If Me.Blocks(x).IsXRef Then&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     'Set xref_file = Me.Blocks.Item(Me.Blocks(x).Name).Reload&lt;BR /&gt;
&amp;gt;     'The line above is what I am having trouble with.&lt;BR /&gt;
&amp;gt;     'I cannot figure out how to attach the object to the xref_file&lt;BR /&gt;
&amp;gt;     'variable.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt; Next x&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/JAGUIRRE&gt;</description>
      <pubDate>Mon, 17 Dec 2001 14:10:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347307#M78669</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-12-17T14:10:27Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347308#M78670</link>
      <description>This works,  thanks.  I was cycling through the blocks but never thought to&lt;BR /&gt;
cycle through the objects.&lt;BR /&gt;
&lt;BR /&gt;
Jorge&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Frank Oquendo" &lt;FRANKO&gt; wrote in message&lt;BR /&gt;
news:79466AB48F77B79CAB1C41A389E7992C@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Contrary to Tony's post, VBA can access the path of an xref just fine. The&lt;BR /&gt;
&amp;gt; trick is getting to the xref. The attached module shows one way to do&lt;BR /&gt;
this.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; If your intention is to repath and reload the xref, once you've changed&lt;BR /&gt;
the&lt;BR /&gt;
&amp;gt; xref path be sure to use the blocks collection to reload it:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; ThisDrawing.Blocks("x").Reload&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; Good judgment comes from experience.&lt;BR /&gt;
&amp;gt; Experience comes from bad judgment.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; http://www.acadx.com&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "Jorge Aguirre" &lt;JAGUIRRE&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:90480FA55016B5A448665C6E2D85C392@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; I am trying to modify the xref block filename and path.  I have written&lt;BR /&gt;
a&lt;BR /&gt;
&amp;gt; &amp;gt; routine that will grab all blocks that are xrefs but I cannot figure out&lt;BR /&gt;
&amp;gt; how&lt;BR /&gt;
&amp;gt; &amp;gt; to incorporate the externalreference object.  Every example I find loads&lt;BR /&gt;
&amp;gt; the&lt;BR /&gt;
&amp;gt; &amp;gt; xref with the code.  I am trying to modify the xref path and file name&lt;BR /&gt;
of&lt;BR /&gt;
&amp;gt; an&lt;BR /&gt;
&amp;gt; &amp;gt; xref that has already been loaded.  Any suggestions.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Dim xref_file As AcadExternalReference&lt;BR /&gt;
&amp;gt; &amp;gt; For x = 0 To Me.Blocks.Count - 1&lt;BR /&gt;
&amp;gt; &amp;gt;     If Me.Blocks(x).IsXRef Then&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;     'Set xref_file = Me.Blocks.Item(Me.Blocks(x).Name).Reload&lt;BR /&gt;
&amp;gt; &amp;gt;     'The line above is what I am having trouble with.&lt;BR /&gt;
&amp;gt; &amp;gt;     'I cannot figure out how to attach the object to the xref_file&lt;BR /&gt;
&amp;gt; &amp;gt;     'variable.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;     End If&lt;BR /&gt;
&amp;gt; &amp;gt; Next x&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
----------------------------------------------------------------------------&lt;BR /&gt;
----&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Attribute VB_Name = "Module1"&lt;BR /&gt;
Public Sub test()&lt;BR /&gt;
&lt;BR /&gt;
    ' Assumes you've referenced COLORWH.DWG in your sample folder.&lt;BR /&gt;
    ' Move COLORWH.DWG to your TEMP folder before running.&lt;BR /&gt;
    Dim ss As AcadSelectionSet, fType, fData&lt;BR /&gt;
    Dim xref As AcadExternalReference&lt;BR /&gt;
&lt;BR /&gt;
    Set ss = CreateSelectionSet&lt;BR /&gt;
    BuildFilter fType, fData, 0, "INSERT", 2, "COLORWH"&lt;BR /&gt;
    ss.Select acSelectionSetAll, , , fType, fData&lt;BR /&gt;
&lt;BR /&gt;
    For Each xref In ss&lt;BR /&gt;
        xref.Path = "C:\Temp\colorwh.dwg"&lt;BR /&gt;
        ThisDrawing.Blocks(xref.Name).Reload&lt;BR /&gt;
    Next&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Public Sub BuildFilter(typeArray, dataArray, ParamArray gCodes())&lt;BR /&gt;
&lt;BR /&gt;
    Dim fType() As Integer, fData()&lt;BR /&gt;
    Dim index As Long, i As Long&lt;BR /&gt;
&lt;BR /&gt;
    index = LBound(gCodes) - 1&lt;BR /&gt;
&lt;BR /&gt;
    For i = LBound(gCodes) To UBound(gCodes) Step 2&lt;BR /&gt;
        index = index + 1&lt;BR /&gt;
        ReDim Preserve fType(0 To index)&lt;BR /&gt;
        ReDim Preserve fData(0 To index)&lt;BR /&gt;
        fType(index) = CInt(gCodes(i))&lt;BR /&gt;
        fData(index) = gCodes(i + 1)&lt;BR /&gt;
    Next&lt;BR /&gt;
    typeArray = fType: dataArray = fData&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Public Function CreateSelectionSet(Optional ssName As String = "ss") As&lt;BR /&gt;
AcadSelectionSet&lt;BR /&gt;
&lt;BR /&gt;
    Dim ss As AcadSelectionSet&lt;BR /&gt;
&lt;BR /&gt;
    On Error Resume Next&lt;BR /&gt;
    Set ss = ThisDrawing.SelectionSets(ssName)&lt;BR /&gt;
    If Err Then Set ss = ThisDrawing.SelectionSets.Add(ssName)&lt;BR /&gt;
    ss.Clear&lt;BR /&gt;
    Set CreateSelectionSet = ss&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;/JAGUIRRE&gt;&lt;/FRANKO&gt;</description>
      <pubDate>Mon, 17 Dec 2001 14:47:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347308#M78670</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-12-17T14:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: modifying xrefs path and filename</title>
      <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347309#M78671</link>
      <description>"Jorge Aguirre" &lt;JAGUIRRE&gt; wrote in message&lt;BR /&gt;
news:90480FA55016B5A448665C6E2D85C392@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I am trying to modify the xref block filename and path.  I have written a&lt;BR /&gt;
&amp;gt; routine that will grab all blocks that are xrefs but I cannot figure out&lt;BR /&gt;
how&lt;BR /&gt;
&amp;gt; to incorporate the externalreference object.  Every example I find loads&lt;BR /&gt;
the&lt;BR /&gt;
&amp;gt; xref with the code.  I am trying to modify the xref path and file name of&lt;BR /&gt;
an&lt;BR /&gt;
&amp;gt; xref that has already been loaded.  Any suggestions.&lt;BR /&gt;
&lt;BR /&gt;
Sorry, my mistake. You can get at the Path of an XRef from&lt;BR /&gt;
VBA.&lt;BR /&gt;
&lt;BR /&gt;
However, the way that several others have suggested doing it&lt;BR /&gt;
is wrong, because it iterates over the Xrefs, and there can&lt;BR /&gt;
be any number of insertions of the same xref in a drawing,&lt;BR /&gt;
in which case, the code repeatedly changes the path of and&lt;BR /&gt;
reloads the same xref multiple times.&lt;BR /&gt;
&lt;BR /&gt;
Use a dictionary or collection to store the name of each&lt;BR /&gt;
xref you have already visited, and you can use it to avoid&lt;BR /&gt;
changing the path and reloading it multiple times.&lt;/JAGUIRRE&gt;</description>
      <pubDate>Mon, 17 Dec 2001 17:02:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347309#M78671</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-12-17T17:02:21Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347310#M78672</link>
      <description>Good point!&lt;BR /&gt;
&lt;BR /&gt;
Joe&lt;BR /&gt;
&lt;BR /&gt;
Tony Tanzillo &lt;TONY.TANZILLO&gt; wrote in message&lt;BR /&gt;
news:71946B8D8F47A996C64B28E557E80A39@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; "Jorge Aguirre" &lt;JAGUIRRE&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:90480FA55016B5A448665C6E2D85C392@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; I am trying to modify the xref block filename and path.  I have written&lt;BR /&gt;
a&lt;BR /&gt;
&amp;gt; &amp;gt; routine that will grab all blocks that are xrefs but I cannot figure out&lt;BR /&gt;
&amp;gt; how&lt;BR /&gt;
&amp;gt; &amp;gt; to incorporate the externalreference object.  Every example I find loads&lt;BR /&gt;
&amp;gt; the&lt;BR /&gt;
&amp;gt; &amp;gt; xref with the code.  I am trying to modify the xref path and file name&lt;BR /&gt;
of&lt;BR /&gt;
&amp;gt; an&lt;BR /&gt;
&amp;gt; &amp;gt; xref that has already been loaded.  Any suggestions.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Sorry, my mistake. You can get at the Path of an XRef from&lt;BR /&gt;
&amp;gt; VBA.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; However, the way that several others have suggested doing it&lt;BR /&gt;
&amp;gt; is wrong, because it iterates over the Xrefs, and there can&lt;BR /&gt;
&amp;gt; be any number of insertions of the same xref in a drawing,&lt;BR /&gt;
&amp;gt; in which case, the code repeatedly changes the path of and&lt;BR /&gt;
&amp;gt; reloads the same xref multiple times.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Use a dictionary or collection to store the name of each&lt;BR /&gt;
&amp;gt; xref you have already visited, and you can use it to avoid&lt;BR /&gt;
&amp;gt; changing the path and reloading it multiple times.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/JAGUIRRE&gt;&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Mon, 17 Dec 2001 17:02:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347310#M78672</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-12-17T17:02:21Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347311#M78673</link>
      <description>This can be simple accomplished without Collection or dictionaries just by&lt;BR /&gt;
checking the current path to the new path.&lt;BR /&gt;
&lt;BR /&gt;
Sudo code:&lt;BR /&gt;
&lt;BR /&gt;
If isXref(x) then&lt;BR /&gt;
    if x.path &amp;lt;&amp;gt; YourPath then&lt;BR /&gt;
        x.path = Yourpath&lt;BR /&gt;
        ThisDrawing.Blocks("x").Reload&lt;BR /&gt;
        end if&lt;BR /&gt;
    end if&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
  |&lt;BR /&gt;
-+-------------------------------------------------&lt;BR /&gt;
  | Rob Starz&lt;BR /&gt;
  | Stardsign cad solutions&lt;BR /&gt;
  | iC - AEC Information Center&lt;BR /&gt;
  | www.stardsign.com/aecic.html&lt;BR /&gt;
  | free ADT and Building Systems tools&lt;BR /&gt;
  | *******LayerX available Now*************&lt;BR /&gt;
  | www.stardsign.com/layerx.htm&lt;BR /&gt;
  | Easter Egg Hunt.....win a free version of LayerX</description>
      <pubDate>Mon, 17 Dec 2001 18:57:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347311#M78673</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-12-17T18:57:01Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347312#M78674</link>
      <description>A dictionary/collection is unnecessary. All you need to do is process the&lt;BR /&gt;
first item in the returned selection set.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Good judgment comes from experience.&lt;BR /&gt;
Experience comes from bad judgment.&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadx.com</description>
      <pubDate>Tue, 18 Dec 2001 05:31:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/modifying-xrefs-path-and-filename/m-p/347312#M78674</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-12-18T05:31:37Z</dc:date>
    </item>
  </channel>
</rss>

