<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
<title>Path of an attached XRef</title>
<link>http://www.zwsoft.com/forum/viewthread.php?tid=1564</link>
<description>
Hi,

i'm trying via the VBA-api to get the path of a XRef from an opened drawing. But i don't get it managed - does anybody know a solution ? &lt;img src=&quot;smileys/smiley5.gif&quot; border=&quot;0&quot; align=&quot;absmiddle&quot; alt=&quot;C&#111;nfused&quot; /&gt;

Sub ListAllXrefPaths()
Dim bdef As ZwcadBlock
Dim bref As ZwcadBlockReference
Dim xref As ZwcadExternalReference
Dim blk As ZwcadBlock
Dim ent As ZwcadEntity
Dim list As New Collection
Dim item As Variant
Dim msg As String

'' handle errors inline
On Error Resume Next

'' iterate block collection
For Each blk In ThisDocument.Blocks

'' iterate entities in block
For Each ent In blk

'' if entity is a blockref
If TypeOf ent Is ZwcadBlockReference Then

'' cast to a blockref interface
Set bref = ent

'' get the related definition
Set bdef = ThisDocument.Blocks(bref.Name)

'' if its an xref
If bdef.IsXRef Then

'' append to collection (duplicates will be skipped)
list.Add bref, bref.Name
End If
End If
Next
Next

'' iterate the collection
For Each item In list

'' cast to an xref
Set xref = item

'' append string
msg = msg &amp;amp; xref.Name &amp;amp; &quot; = &quot; &amp;amp; xref.Path &amp;amp; vbCr
Next

'' show it
MsgBox msg, , &quot;ListAllXrefPaths&quot;
End Sub


holfort2010-05-08 06:31:08</description>
<author>holfort</author>
<pubDate>2010-05-08 05:34:06</pubDate>
<item><link>http://www.zwsoft.com/forum/viewthread.php?tid=1564&amp;pid=12480</link>
<description>
 
good work,holfort
 

the code seems have attracted me ,i want to learn VBA and hope i can discuss about VBAwith you then~ </description>
<author>ZWCAD_Eric</author>
<pubDate>2010-05-12 08:45:45</pubDate>
</item><item><link>http://www.zwsoft.com/forum/viewthread.php?tid=1564&amp;pid=12476</link>
<description>
 
hi,holfort,
 

  i will feel happy to talk about VBA with you ~~ ,but in fact, i know nothing about VBA&lt;img src=&quot;http://classic.zwcad.org/forum/smileys/smiley9.gif&quot; height=&quot;17&quot; width=&quot;17&quot; border=&quot;0&quot; align=&quot;absmiddle&quot; alt=&quot;Embarrassed&quot; /&gt; now ,hope there are someone can share with you about VBA here . 
 
 good mood~~
Eric
 </description>
<author>ZWCAD_Eric</author>
<pubDate>2010-05-10 10:22:53</pubDate>
</item>  </channel>
</rss>