<?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: Getting all XRef's In VBA in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/getting-all-xref-s-in-vba/m-p/339869#M83972</link>
    <description>Cycle through the Blocks colelction checking the IsXref&lt;BR /&gt;
property. When it returns True, create a filtered selection&lt;BR /&gt;
set using the name of that block. Doing so will yield every&lt;BR /&gt;
xref insert regardless of which space block it is contained&lt;BR /&gt;
in:&lt;BR /&gt;
&lt;BR /&gt;
Dim blkDef As AcadBlock, xref As AcadExternalReference&lt;BR /&gt;
Dim fType(1) As Integer, fData(1)&lt;BR /&gt;
Dim ss As AcadSelectionSet&lt;BR /&gt;
&lt;BR /&gt;
Set ss = ThisDrawing.Selectionsets.Add("ss")&lt;BR /&gt;
&lt;BR /&gt;
fType(0) = 0 : fData(0) = "INSERT"&lt;BR /&gt;
fType(1) = 2&lt;BR /&gt;
&lt;BR /&gt;
For Each blkDef In ThisDrawing.Blocks&lt;BR /&gt;
    If blkDef.IsXref Then&lt;BR /&gt;
        fData(1) = blkDef.Name&lt;BR /&gt;
        ss.Select , , fType, fData&lt;BR /&gt;
        For Each xref In ss&lt;BR /&gt;
            &lt;DO your="" thing=""&gt;&lt;BR /&gt;
        Next&lt;BR /&gt;
    End If&lt;BR /&gt;
Next&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Barry Bell" &lt;BARRY&gt; wrote in message&lt;BR /&gt;
news:2DD44CAEE63F7A534C96A915FBD0E4BF@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I am trying to find out all the XRefs for a document in&lt;BR /&gt;
the following way,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; Sub getxrefs()&lt;BR /&gt;
&amp;gt;     Dim myXRefs As AcadExternalReference&lt;BR /&gt;
&amp;gt;     For Each myXRefs In ActiveDocument.ModelSpace&lt;BR /&gt;
&amp;gt;     MsgBox myXRefs.Path&lt;BR /&gt;
&amp;gt;     Next&lt;BR /&gt;
&amp;gt;     UserForm1.Show&lt;BR /&gt;
&amp;gt; End Sub&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; This is fine for ModelSpace XRefs but I would to get all&lt;BR /&gt;
the XRefs for&lt;BR /&gt;
&amp;gt; PaperSpace as well. I thought that it would be a case of&lt;BR /&gt;
changing the third&lt;BR /&gt;
&amp;gt; line to 'For Each myXRefs In ActiveDocument.PaperSpace'&lt;BR /&gt;
but this does not&lt;BR /&gt;
&amp;gt; work.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Any help with PaperSpace XRef's would be most gratefully&lt;BR /&gt;
received.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Barry Bell&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/BARRY&gt;&lt;/DO&gt;</description>
    <pubDate>Tue, 22 May 2001 06:18:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2001-05-22T06:18:01Z</dc:date>
    <item>
      <title>Getting all XRef's In VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/getting-all-xref-s-in-vba/m-p/339868#M83971</link>
      <description>I am trying to find out all the XRefs for a document in the following way,&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Sub getxrefs()&lt;BR /&gt;
    Dim myXRefs As AcadExternalReference&lt;BR /&gt;
    For Each myXRefs In ActiveDocument.ModelSpace&lt;BR /&gt;
    MsgBox myXRefs.Path&lt;BR /&gt;
    Next&lt;BR /&gt;
    UserForm1.Show&lt;BR /&gt;
End Sub&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
This is fine for ModelSpace XRefs but I would to get all the XRefs for&lt;BR /&gt;
PaperSpace as well. I thought that it would be a case of changing the third&lt;BR /&gt;
line to 'For Each myXRefs In ActiveDocument.PaperSpace' but this does not&lt;BR /&gt;
work.&lt;BR /&gt;
&lt;BR /&gt;
Any help with PaperSpace XRef's would be most gratefully received.&lt;BR /&gt;
&lt;BR /&gt;
Barry Bell</description>
      <pubDate>Tue, 22 May 2001 05:10:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/getting-all-xref-s-in-vba/m-p/339868#M83971</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-05-22T05:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Getting all XRef's In VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/getting-all-xref-s-in-vba/m-p/339869#M83972</link>
      <description>Cycle through the Blocks colelction checking the IsXref&lt;BR /&gt;
property. When it returns True, create a filtered selection&lt;BR /&gt;
set using the name of that block. Doing so will yield every&lt;BR /&gt;
xref insert regardless of which space block it is contained&lt;BR /&gt;
in:&lt;BR /&gt;
&lt;BR /&gt;
Dim blkDef As AcadBlock, xref As AcadExternalReference&lt;BR /&gt;
Dim fType(1) As Integer, fData(1)&lt;BR /&gt;
Dim ss As AcadSelectionSet&lt;BR /&gt;
&lt;BR /&gt;
Set ss = ThisDrawing.Selectionsets.Add("ss")&lt;BR /&gt;
&lt;BR /&gt;
fType(0) = 0 : fData(0) = "INSERT"&lt;BR /&gt;
fType(1) = 2&lt;BR /&gt;
&lt;BR /&gt;
For Each blkDef In ThisDrawing.Blocks&lt;BR /&gt;
    If blkDef.IsXref Then&lt;BR /&gt;
        fData(1) = blkDef.Name&lt;BR /&gt;
        ss.Select , , fType, fData&lt;BR /&gt;
        For Each xref In ss&lt;BR /&gt;
            &lt;DO your="" thing=""&gt;&lt;BR /&gt;
        Next&lt;BR /&gt;
    End If&lt;BR /&gt;
Next&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Barry Bell" &lt;BARRY&gt; wrote in message&lt;BR /&gt;
news:2DD44CAEE63F7A534C96A915FBD0E4BF@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I am trying to find out all the XRefs for a document in&lt;BR /&gt;
the following way,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; Sub getxrefs()&lt;BR /&gt;
&amp;gt;     Dim myXRefs As AcadExternalReference&lt;BR /&gt;
&amp;gt;     For Each myXRefs In ActiveDocument.ModelSpace&lt;BR /&gt;
&amp;gt;     MsgBox myXRefs.Path&lt;BR /&gt;
&amp;gt;     Next&lt;BR /&gt;
&amp;gt;     UserForm1.Show&lt;BR /&gt;
&amp;gt; End Sub&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; This is fine for ModelSpace XRefs but I would to get all&lt;BR /&gt;
the XRefs for&lt;BR /&gt;
&amp;gt; PaperSpace as well. I thought that it would be a case of&lt;BR /&gt;
changing the third&lt;BR /&gt;
&amp;gt; line to 'For Each myXRefs In ActiveDocument.PaperSpace'&lt;BR /&gt;
but this does not&lt;BR /&gt;
&amp;gt; work.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Any help with PaperSpace XRef's would be most gratefully&lt;BR /&gt;
received.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Barry Bell&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/BARRY&gt;&lt;/DO&gt;</description>
      <pubDate>Tue, 22 May 2001 06:18:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/getting-all-xref-s-in-vba/m-p/339869#M83972</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-05-22T06:18:01Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/getting-all-xref-s-in-vba/m-p/339870#M83973</link>
      <description>So if there is no dxf code to for getting a selection set of Xref's. Using&lt;BR /&gt;
the code supplied by frank. How can I change the layer of the xref? I have&lt;BR /&gt;
tried several things and nothing has worked for me.&lt;BR /&gt;
&lt;BR /&gt;
Heath&lt;BR /&gt;
&lt;BR /&gt;
"Frank Oquendo" &lt;FRANKO&gt; wrote in message&lt;BR /&gt;
news:589EA01EC18CE849DC5F8EB4ACFB9CC3@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Cycle through the Blocks colelction checking the IsXref&lt;BR /&gt;
&amp;gt; property. When it returns True, create a filtered selection&lt;BR /&gt;
&amp;gt; set using the name of that block. Doing so will yield every&lt;BR /&gt;
&amp;gt; xref insert regardless of which space block it is contained&lt;BR /&gt;
&amp;gt; in:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Dim blkDef As AcadBlock, xref As AcadExternalReference&lt;BR /&gt;
&amp;gt; Dim fType(1) As Integer, fData(1)&lt;BR /&gt;
&amp;gt; Dim ss As AcadSelectionSet&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Set ss = ThisDrawing.Selectionsets.Add("ss")&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; fType(0) = 0 : fData(0) = "INSERT"&lt;BR /&gt;
&amp;gt; fType(1) = 2&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; For Each blkDef In ThisDrawing.Blocks&lt;BR /&gt;
&amp;gt;     If blkDef.IsXref Then&lt;BR /&gt;
&amp;gt;         fData(1) = blkDef.Name&lt;BR /&gt;
&amp;gt;         ss.Select , , fType, fData&lt;BR /&gt;
&amp;gt;         For Each xref In ss&lt;BR /&gt;
&amp;gt;             &lt;DO your="" thing=""&gt;&lt;BR /&gt;
&amp;gt;         Next&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt; Next&lt;BR /&gt;
&amp;gt;&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; "Barry Bell" &lt;BARRY&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:2DD44CAEE63F7A534C96A915FBD0E4BF@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; I am trying to find out all the XRefs for a document in&lt;BR /&gt;
&amp;gt; the following way,&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; --&lt;BR /&gt;
&amp;gt; &amp;gt; Sub getxrefs()&lt;BR /&gt;
&amp;gt; &amp;gt;     Dim myXRefs As AcadExternalReference&lt;BR /&gt;
&amp;gt; &amp;gt;     For Each myXRefs In ActiveDocument.ModelSpace&lt;BR /&gt;
&amp;gt; &amp;gt;     MsgBox myXRefs.Path&lt;BR /&gt;
&amp;gt; &amp;gt;     Next&lt;BR /&gt;
&amp;gt; &amp;gt;     UserForm1.Show&lt;BR /&gt;
&amp;gt; &amp;gt; End Sub&lt;BR /&gt;
&amp;gt; &amp;gt; --&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; This is fine for ModelSpace XRefs but I would to get all&lt;BR /&gt;
&amp;gt; the XRefs for&lt;BR /&gt;
&amp;gt; &amp;gt; PaperSpace as well. I thought that it would be a case of&lt;BR /&gt;
&amp;gt; changing the third&lt;BR /&gt;
&amp;gt; &amp;gt; line to 'For Each myXRefs In ActiveDocument.PaperSpace'&lt;BR /&gt;
&amp;gt; but this does not&lt;BR /&gt;
&amp;gt; &amp;gt; work.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Any help with PaperSpace XRef's would be most gratefully&lt;BR /&gt;
&amp;gt; received.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Barry Bell&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;/BARRY&gt;&lt;/DO&gt;&lt;/FRANKO&gt;</description>
      <pubDate>Wed, 23 May 2001 16:58:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/getting-all-xref-s-in-vba/m-p/339870#M83973</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-05-23T16:58:55Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/getting-all-xref-s-in-vba/m-p/339871#M83974</link>
      <description>An xref is another type of insert. Once you've collected the inserts&lt;BR /&gt;
using a filtered selection set, you can cast the AcadBlockReference to&lt;BR /&gt;
an AcadExternalReference:&lt;BR /&gt;
&lt;BR /&gt;
Dim xref As AcadExternalReference&lt;BR /&gt;
&lt;BR /&gt;
For Each xref In ss&lt;BR /&gt;
    xref.Layer = &lt;YOUR layer="" here=""&gt;&lt;BR /&gt;
Next&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Heath" &lt;HRHODES&gt; wrote in message&lt;BR /&gt;
news:5389EAF53953098CDEADF430B8808801@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; So if there is no dxf code to for getting a selection set of Xref's.&lt;BR /&gt;
Using&lt;BR /&gt;
&amp;gt; the code supplied by frank. How can I change the layer of the xref?&lt;BR /&gt;
I have&lt;BR /&gt;
&amp;gt; tried several things and nothing has worked for me.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Heath&lt;/HRHODES&gt;&lt;/YOUR&gt;</description>
      <pubDate>Wed, 23 May 2001 17:40:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/getting-all-xref-s-in-vba/m-p/339871#M83974</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-05-23T17:40:52Z</dc:date>
    </item>
  </channel>
</rss>

