<?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: Removing 1 item from a dynamic array? in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012232#M55025</link>
    <description>I'd be happy to - after reading your other reply it sounds like a much
easier option.  Unfortunately for me, I know less about creating a
collection than I do an array!  I thought collections were built in - I did
not know you could make your own.  Or can you?  Could you toss out an
example?


"Mark Propst" &lt;NOTMARK-AT-ATRENG-DOT-COM&gt; wrote in message
news:4087f31d_2@newsprd01...
&amp;gt; my opinion: abandon arrays, use collections
&amp;gt;
&amp;gt; "pkirill" &lt;PKIRILL&gt; wrote in message
&amp;gt; news:4087efae$1_3@newsprd01...
&amp;gt; &amp;gt; Can anyone show me an example of how to remove a single item from an
&amp;gt; array?
&amp;gt;
&amp;gt;&lt;/PKIRILL&gt;&lt;/NOTMARK-AT-ATRENG-DOT-COM&gt;</description>
    <pubDate>Thu, 22 Apr 2004 18:08:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2004-04-22T18:08:04Z</dc:date>
    <item>
      <title>Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012229#M55022</link>
      <description>Can anyone show me an example of how to remove a single item from an array?
For example, if I have added items to an array to get this:

item1
item2
item3
item4
item5

and I need to remove item3 so the array now consists of this:

item1
item2
item4
item5

The catch being that I wouldn't know an exact number or index position - all
I have is partial text string to match.  So in this example I would be
using:  Like "*3" somewhere...  right?

This ties into my earlier question about identifying the total number of
items in a dynamic array...</description>
      <pubDate>Thu, 22 Apr 2004 16:16:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012229#M55022</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-22T16:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012230#M55023</link>
      <description>The way I have done it in the past is to swap items 3 and 5 then do a 
redim preserve array(4).  I don't know of a better way.  if it were a 
listbox then you could just do a
x = me.ListBox1.ListIndex
listbox1.removeitem x

If there is a better way for an array I would like to know.

David Urban

pkirill wrote:
&amp;gt; Can anyone show me an example of how to remove a single item from an array?
&amp;gt; For example, if I have added items to an array to get this:
&amp;gt; 
&amp;gt; item1
&amp;gt; item2
&amp;gt; item3
&amp;gt; item4
&amp;gt; item5
&amp;gt; 
&amp;gt; and I need to remove item3 so the array now consists of this:
&amp;gt; 
&amp;gt; item1
&amp;gt; item2
&amp;gt; item4
&amp;gt; item5
&amp;gt; 
&amp;gt; The catch being that I wouldn't know an exact number or index position - all
&amp;gt; I have is partial text string to match.  So in this example I would be
&amp;gt; using:  Like "*3" somewhere...  right?
&amp;gt; 
&amp;gt; This ties into my earlier question about identifying the total number of
&amp;gt; items in a dynamic array...
&amp;gt; 
&amp;gt;</description>
      <pubDate>Thu, 22 Apr 2004 16:23:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012230#M55023</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-22T16:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012231#M55024</link>
      <description>my opinion: abandon arrays, use collections

"pkirill" &lt;PKIRILL&gt; wrote in message
news:4087efae$1_3@newsprd01...
&amp;gt; Can anyone show me an example of how to remove a single item from an
array?&lt;/PKIRILL&gt;</description>
      <pubDate>Thu, 22 Apr 2004 16:36:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012231#M55024</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-22T16:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012232#M55025</link>
      <description>I'd be happy to - after reading your other reply it sounds like a much
easier option.  Unfortunately for me, I know less about creating a
collection than I do an array!  I thought collections were built in - I did
not know you could make your own.  Or can you?  Could you toss out an
example?


"Mark Propst" &lt;NOTMARK-AT-ATRENG-DOT-COM&gt; wrote in message
news:4087f31d_2@newsprd01...
&amp;gt; my opinion: abandon arrays, use collections
&amp;gt;
&amp;gt; "pkirill" &lt;PKIRILL&gt; wrote in message
&amp;gt; news:4087efae$1_3@newsprd01...
&amp;gt; &amp;gt; Can anyone show me an example of how to remove a single item from an
&amp;gt; array?
&amp;gt;
&amp;gt;&lt;/PKIRILL&gt;&lt;/NOTMARK-AT-ATRENG-DOT-COM&gt;</description>
      <pubDate>Thu, 22 Apr 2004 18:08:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012232#M55025</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-22T18:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012233#M55026</link>
      <description>Sub TestCollection()
Dim colStuff as New Collection
colStuff.Add "Whatever"
colStuff.Add "Whatever else"
dim i as integer
for i = 1 to 25
colStuff.Add i
next

colStuff.Add "Even more stuff"
colStuff.Add "Even more stuff"
colStuff.Add "Whatever else"
colStuff.Add "Even more stuff"

for i = 1 to colStuff.count
debug.print colStuff(i)
next

set colStuff = Nothing


end sub

note collections are 1 based where arrays are (usually) 0 based

"pkirill" &lt;PKIRILL&gt; wrote in message
news:408809cd$1_2@newsprd01...
&amp;gt; I'd be happy to - after reading your other reply it sounds like a much
&amp;gt; easier option.  Unfortunately for me, I know less about creating a
&amp;gt; collection than I do an array!  I thought collections were built in - I
did
&amp;gt; not know you could make your own.  Or can you?  Could you toss out an
&amp;gt; example?
&amp;gt;
&amp;gt;
&amp;gt; "Mark Propst" &lt;NOTMARK-AT-ATRENG-DOT-COM&gt; wrote in message
&amp;gt; news:4087f31d_2@newsprd01...
&amp;gt; &amp;gt; my opinion: abandon arrays, use collections
&amp;gt; &amp;gt;
&amp;gt; &amp;gt; "pkirill" &lt;PKIRILL&gt; wrote in message
&amp;gt; &amp;gt; news:4087efae$1_3@newsprd01...
&amp;gt; &amp;gt; &amp;gt; Can anyone show me an example of how to remove a single item from an
&amp;gt; &amp;gt; array?
&amp;gt; &amp;gt;
&amp;gt; &amp;gt;
&amp;gt;
&amp;gt;&lt;/PKIRILL&gt;&lt;/NOTMARK-AT-ATRENG-DOT-COM&gt;&lt;/PKIRILL&gt;</description>
      <pubDate>Thu, 22 Apr 2004 19:58:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012233#M55026</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-22T19:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012234#M55027</link>
      <description>Forget collections as well. Use a Dictionary - Microsoft's not Autodesk's.
It takes collections to the next level - AND includes a remove item method.
Here is an example of late-binding to it:

  Dim mDict As Object
  Set mDict = CreateObject("Scripting.Dictionary")

Paste the code with a break and play with the mDict in the immediate window
while your code is broken. You could also just set a reference to the
Microsoft Scripting Runtime and use the object browser tto explore it.
-- 
___________________________
Mike Tuersley
CADalyst's AutoCAD Clinic
Rand IMAGINiT Technologies</description>
      <pubDate>Thu, 22 Apr 2004 20:12:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012234#M55027</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-22T20:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012235#M55028</link>
      <description>Right!
I always forget about that one.
Seems like I've seen some comments about why not to use them, but if you're
recommending them that's enough for me!

now to retrain my habits!!!
Thanks
Mark

"Mike Tuersley" &lt;MTUERSLEY&gt; wrote in message
news:1sc65ulx61qv4.15yh7kha9d80k$.dlg@40tude.net...
&amp;gt; Forget collections as well. Use a Dictionary - Microsoft's not Autodesk's.&lt;/MTUERSLEY&gt;</description>
      <pubDate>Thu, 22 Apr 2004 20:50:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012235#M55028</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-22T20:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012236#M55029</link>
      <description>Thanks, Mark and Mike - It seems collections are easier than I thought...
Certainly easier than an array in this case.

Thanks for all the details, much appreciated!


"Mark Propst" &lt;NOTMARK-AT-ATRENG-DOT-COM&gt; wrote in message
news:40882eba$1_3@newsprd01...
&amp;gt; Right!
&amp;gt; I always forget about that one.
&amp;gt; Seems like I've seen some comments about why not to use them, but if
you're
&amp;gt; recommending them that's enough for me!
&amp;gt;
&amp;gt; now to retrain my habits!!!
&amp;gt; Thanks
&amp;gt; Mark
&amp;gt;
&amp;gt; "Mike Tuersley" &lt;MTUERSLEY&gt; wrote in message
&amp;gt; news:1sc65ulx61qv4.15yh7kha9d80k$.dlg@40tude.net...
&amp;gt; &amp;gt; Forget collections as well. Use a Dictionary - Microsoft's not
Autodesk's.
&amp;gt;
&amp;gt;&lt;/MTUERSLEY&gt;&lt;/NOTMARK-AT-ATRENG-DOT-COM&gt;</description>
      <pubDate>Fri, 23 Apr 2004 12:07:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012236#M55029</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-23T12:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012237#M55030</link>
      <description>Hmmm.... only reasons I can think of are:

1. Purist - sticking to just what vba offers
2. Possibly some incompatability between different OSs

I use it all the time and haven't run into any issues with it. One of my
most common implementations is using it with a text file *if* the
customer's other software that I am integrating with only kicks out text.
I'll populate the dict with the text data so I can search, etc.

'Course if there is a valid argument against it, I'd have to re-asses my
approach;)

Mike

-- 
___________________________
Mike Tuersley
CADalyst's AutoCAD Clinic
Rand IMAGINiT Technologies</description>
      <pubDate>Fri, 23 Apr 2004 14:10:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012237#M55030</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-23T14:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012238#M55031</link>
      <description>I'm definitely not certain (hows that for a phrase? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ) that there are any
valid reasons against it.
...just a little dust floating in the back of my cobwebbed brain hollows
that thought it heard something somewhere once maybe...uh....hmm....

The other aspect I've considered in regard to either collections or
dictionaries is *if* I need to store info - either in the dwg or otherwise -
then I need to transfer the data from the temporary storage to an acad
dictionary or store it in xml or text or whatever and somehow key that file
to the dwg.

Thats why I need to study your other example on xml - so that it could be
transferred from the scripting dict (since that will be a convenient though
transient storage medium).

"Mike Tuersley" &lt;MTUERSLEY&gt; wrote in message
news:k0u7e3pseyo$.g7kg2fqo2ihl$.dlg@40tude.net...
&amp;gt; Hmmm.... only reasons I can think of are:
&amp;gt;
&amp;gt; 'Course if there is a valid argument against it, I'd have to re-asses my
&amp;gt; approach;)
&amp;gt;
&amp;gt; Mike&lt;/MTUERSLEY&gt;</description>
      <pubDate>Fri, 23 Apr 2004 21:07:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012238#M55031</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-23T21:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012239#M55032</link>
      <description>If you want a more detailed example on xml, let me know. The one posted is
very basic and uses a SQL query against it instead of a normal parser.</description>
      <pubDate>Sat, 24 Apr 2004 12:45:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012239#M55032</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-24T12:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012240#M55033</link>
      <description>oooh oooh oooh! :-)
Yes please, that'd be really nice!
I got the two references installed/ the vbaccelerator treeview control and
the 2.8mdac
and that's a great little example of using different storage mediums for the
same info.

a further example on xml would be much appreciated....
always easier to learn from a few actual examples than reems of msdn pages!
Thanks in advance
Mark

"Mike Tuersley" &lt;MTUERSLEY&gt; wrote in message
news:1jc7sj0rgon5s$.2i20vfwqhnzt$.dlg@40tude.net...
&amp;gt; If you want a more detailed example on xml, let me know. The one posted is
&amp;gt; very basic and uses a SQL query against it instead of a normal parser.&lt;/MTUERSLEY&gt;</description>
      <pubDate>Sun, 25 Apr 2004 22:24:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012240#M55033</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-25T22:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012241#M55034</link>
      <description>I wrote an XML reader and writer that uses the parser. It uses a simple 
file that I save my UDT to and load my UDT from each time.  I found 
documentation on how to use an XML file in VB very sparse.  Thanks MS.
I have attached my file.

David Urban

Mark Propst wrote:
&amp;gt; oooh oooh oooh! :-)
&amp;gt; Yes please, that'd be really nice!
&amp;gt; I got the two references installed/ the vbaccelerator treeview control and
&amp;gt; the 2.8mdac
&amp;gt; and that's a great little example of using different storage mediums for the
&amp;gt; same info.
&amp;gt; 
&amp;gt; a further example on xml would be much appreciated....
&amp;gt; always easier to learn from a few actual examples than reems of msdn pages!
&amp;gt; Thanks in advance
&amp;gt; Mark
&amp;gt; 
&amp;gt; "Mike Tuersley" &lt;MTUERSLEY&gt; wrote in message
&amp;gt; news:1jc7sj0rgon5s$.2i20vfwqhnzt$.dlg@40tude.net...
&amp;gt; 
&amp;gt;&amp;gt;If you want a more detailed example on xml, let me know. The one posted is
&amp;gt;&amp;gt;very basic and uses a SQL query against it instead of a normal parser.
&amp;gt; 
&amp;gt; 
&amp;gt; 
Attribute VB_Name = "XML"
Option Explicit
Public Sub Save_toXML()
Dim oDoc As DOMDocument
    
    Dim oAlg As IXMLDOMElement
    Dim oSta As IXMLDOMElement
    Dim oLat1 As IXMLDOMElement
    Dim oLat2 As IXMLDOMElement
    Dim oRoot As IXMLDOMElement
    Dim oStation As IXMLDOMAttribute
          
    Set oDoc = Nothing
    
    Set oDoc = New DOMDocument
    oDoc.async = False

    On Error Resume Next
    oDoc.Load (fXMLFile)
                                                                                                                                                                                                                               Set oRoot = oDoc.documentElement
'If Err.Number &amp;lt;&amp;gt; 0 Then
    oDoc.resolveExternals = True
 If oDoc.parseError &amp;lt;&amp;gt; 0 Then
' Create processing instruction and document root
    Set oAlg = oDoc.createProcessingInstruction("xml", "version='1.0'")
    Set oAlg = oDoc.insertBefore(oAlg, oDoc.childNodes.Item(0))
    
' Create document root
    Set oRoot = oDoc.createElement("Project_" &amp;amp; CStr(Project))
    Set oDoc.documentElement = oRoot
'    oRoot.setAttribute "xmlns:dt", "urn:schemas-microsoft-com:datatypes"

'Else
'Set oRoot = oDoc.documentElement
End If
Err.Clear
Dim events As Variant, alignName As String
Dim x As Integer, name As String, name2 As String
name = Replace(algname, " ", "_")
alignName = "//Project_" &amp;amp; CStr(Project) &amp;amp; "//" &amp;amp; name
Set oAlg = oDoc.selectSingleNode(alignName)
name2 = oAlg.baseName
If name2 &amp;lt;&amp;gt; "" Then
    oRoot.removeChild oAlg
End If
    Set oAlg = oDoc.createElement(name)
    oRoot.appendChild oAlg
For x = LBound(AlignPt, 1) To UBound(AlignPt, 1)
    Set oSta = oDoc.createElement("Sta" &amp;amp; Format(AlignPt(x).Station, "0.00"))
    oAlg.appendChild oSta
    Write_XMLStation oSta, oDoc, AlignPt(x)
Next x

    

' Save xml file
    oDoc.Save fXMLFile
    
End Sub
Public Function Load_fromXML() As Boolean
Dim oDoc As DOMDocument
    Dim oAlg As IXMLDOMNode, nodes As IXMLDOMNode
    Dim oSta As IXMLDOMElement
    Dim oLat1 As IXMLDOMElement
    Dim oLat2 As IXMLDOMElement
          
    Set oDoc = Nothing
    
    Set oDoc = New DOMDocument
    oDoc.async = False

    On Error Resume Next
    oDoc.Load (fXMLFile)
'Set oRoot = oDoc.documentElement
'If Err.Number &amp;lt;&amp;gt; 0 Then
    oDoc.resolveExternals = True
 If oDoc.parseError = 0 Then

Dim alignName As String
Dim x As Integer, name As String, name2 As String
name = Replace(algname, " ", "_")
alignName = "//Project_" &amp;amp; CStr(Project) &amp;amp; "//" &amp;amp; name
Set oAlg = oDoc.selectSingleNode(alignName)
Debug.Print Err.Number
name2 = oAlg.baseName
If name2 &amp;lt;&amp;gt; "" Then
Debug.Print Err.Number
ReDim AlignPt(oAlg.childNodes.length - 1)
For x = 0 To oAlg.childNodes.length - 1
     Set oSta = oAlg.childNodes.Item(x)
        Read_XMLStation oSta, AlignPt(x)
Next x
Load_fromXML = True
End If
End If
Set oDoc = Nothing

End Function
Public Function Delete_Sta_fromXML(Station) As Boolean
Dim oDoc As DOMDocument
Delete_Sta_fromXML = False
Dim oAlg As IXMLDOMElement
Dim oSta As IXMLDOMNode
Dim oRoot As IXMLDOMElement, oTree As IXMLDOMNamedNodeMap
      
Set oDoc = Nothing

Set oDoc = New DOMDocument
oDoc.async = False

On Error Resume Next
oDoc.Load (fXMLFile)
                                                                                                                                                                                                                               Set oRoot = oDoc.documentElement
If Err.Number = 0 Then
    oDoc.resolveExternals = True
 If oDoc.parseError = 0 Then
Dim alignName As String
Dim x As Integer, name As String
name = Replace(algname, " ", "_")
alignName = "//Project_" &amp;amp; CStr(Project) &amp;amp; "//" &amp;amp; name
Set oAlg = oDoc.selectSingleNode(alignName)
alignName = "//Project_" &amp;amp; CStr(Project) &amp;amp; "//" &amp;amp; name &amp;amp; "//" &amp;amp; "Sta" &amp;amp; Format(Station, "0.00")
Set oSta = oDoc.selectSingleNode(alignName)
oAlg.removeChild oSta
oDoc.Save fXMLFile
Delete_Sta_fromXML = True
End If
End If
End Function
Public Function Update_station(temp As junctions) As Boolean
Dim oDoc As DOMDocument
Update_station = False
Dim oAlg As IXMLDOMNode, nodes As IXMLDOMNode
Dim oSta As IXMLDOMElement
Dim oLat1 As IXMLDOMElement
Dim oLat2 As IXMLDOMElement
Update_station = False

Set oDoc = Nothing
Set oDoc = New DOMDocument
oDoc.async = False
Err.Clear: On Error Resume Next
oDoc.Load (fXMLFile)
If Err.Number = 0 Then
    oDoc.resolveExternals = True
    If oDoc.parseError = 0 Then
        Dim alignName As String
        Dim x As Integer, name As String, name2 As String
        name = Replace(algname, " ", "_")
        alignName = "//Project_" &amp;amp; CStr(Project) &amp;amp; "//" &amp;amp; name
        Set oAlg = oDoc.selectSingleNode(alignName)
        alignName = "//Project_" &amp;amp; CStr(Project) &amp;amp; "//" &amp;amp; name &amp;amp; "//" &amp;amp; "Sta" &amp;amp; Format(temp.Station, "0.00")
        Set oSta = oDoc.selectSingleNode(alignName)
        Debug.Print Err.Number
        name2 = oSta.baseName
        If name2 &amp;lt;&amp;gt; "" Then
            oAlg.removeChild oSta
        End If
            Set oSta = oDoc.createElement("Sta" &amp;amp; Format(temp.Station, "0.00"))
            oAlg.appendChild oSta
            Write_XMLStation oSta, oDoc, temp
            oDoc.Save fXMLFile
            Update_station = True
    End If
End If
End Function

Private Sub Write_XMLStation(oSta As IXMLDOMElement, oDoc As DOMDocument, temp As junctions)
Dim oLat1 As IXMLDOMElement, oLat2 As IXMLDOMElement
    oSta.setAttribute "Station", temp.Station
    oSta.setAttribute "Event", temp.Event
    oSta.setAttribute "Direction", temp.Direction
    oSta.setAttribute "DirectionUP", temp.DirectionUP
    oSta.setAttribute "Easting", temp.Easting
    oSta.setAttribute "Northing", temp.Northing
    oSta.setAttribute "Pipesize", temp.Pipesize
    oSta.setAttribute "PipesizeUP", temp.PipesizeUP
    oSta.setAttribute "Flowline", temp.FlowLine
    Set oLat1 = oDoc.createElement("Lateral1")
    oSta.appendChild oLat1
    oLat1.setAttribute "name", temp.Lateral1.name
    oLat1.setAttribute "Station", temp.Lateral1.INTStation
    oLat1.setAttribute "count", temp.Lateral1.count
    oLat1.setAttribute "Direction", temp.Lateral1.Direction
    oLat1.setAttribute "eEast", temp.Lateral1.EndEasting
    oLat1.setAttribute "eNorth", temp.Lateral1.EndNorthing
    oLat1.setAttribute "eSta", temp.Lateral1.EndStation
    Set oLat2 = oDoc.createElement("Lateral2")
    oSta.appendChild oLat2
    oLat2.setAttribute "name", temp.Lateral2.name
    oLat2.setAttribute "Station", temp.Lateral2.INTStation
    oLat2.setAttribute "count", temp.Lateral2.count
    oLat2.setAttribute "Direction", temp.Lateral2.Direction
    oLat2.setAttribute "eEast", temp.Lateral2.EndEasting
    oLat2.setAttribute "eNorth", temp.Lateral2.EndNorthing
    oLat2.setAttribute "eSta", temp.Lateral2.EndStation

End Sub
Private Sub Read_XMLStation(oSta As IXMLDOMElement, temp As junctions)
Dim oLat1 As IXMLDOMElement, oLat2 As IXMLDOMElement
With temp
        .Station = oSta.getAttribute("Station")
        .Event = oSta.getAttribute("Event")
        .Direction = oSta.getAttribute("Direction")
        .DirectionUP = oSta.getAttribute("DirectionUP")
        .Easting = oSta.getAttribute("Easting")
        .Northing = oSta.getAttribute("Northing")
        .Pipesize = oSta.getAttribute("Pipesize")
        .PipesizeUP = oSta.getAttribute("PipesizeUP")
        .FlowLine = oSta.getAttribute("Flowline")
        Set oLat1 = oSta.firstChild
        .Lateral1.name = oLat1.getAttribute("name")
        .Lateral1.INTStation = oLat1.getAttribute("Station")
        .Lateral1.count = oLat1.getAttribute("count")
        .Lateral1.Direction = oLat1.getAttribute("Direction")
        .Lateral1.EndEasting = oLat1.getAttribute("eEast")
        .Lateral1.EndNorthing = oLat1.getAttribute("eNorth")
        .Lateral1.EndStation = oLat1.getAttribute("eSta")
        Set oLat2 = oSta.lastChild
        .Lateral2.name = oLat2.getAttribute("name")
        .Lateral2.INTStation = oLat2.getAttribute("Station")
        .Lateral2.count = oLat2.getAttribute("count")
        .Lateral2.Direction = oLat2.getAttribute("Direction")
        .Lateral2.EndEasting = oLat2.getAttribute("eEast")
        .Lateral2.EndNorthing = oLat2.getAttribute("eNorth")
        .Lateral2.EndStation = oLat2.getAttribute("eSta")
End With
End Sub
Public Function read_rec_fromXML(alignmentName As String, Station As Double, Xtemp As junctions) As Boolean
Dim oDoc As DOMDocument
read_rec_fromXML = False
Dim oAlg As IXMLDOMNode, nodes As IXMLDOMNode
Dim oSta As IXMLDOMElement
Dim oLat1 As IXMLDOMElement
Dim oLat2 As IXMLDOMElement

Set oDoc = Nothing
Set oDoc = New DOMDocument
oDoc.async = False
Err.Clear: On Error Resume Next
oDoc.Load (fXMLFile)
If Err.Number = 0 Then
    oDoc.resolveExternals = True
    If oDoc.parseError = 0 Then
        Dim alignName As String
        Dim x As Integer, name As String, name2 As String
        name = Replace(alignmentName, " ", "_")
        alignName = "//Project_" &amp;amp; CStr(Project) &amp;amp; "//" &amp;amp; name
        Set oAlg = oDoc.selectSingleNode(alignName)
        alignName = "//Project_" &amp;amp; CStr(Project) &amp;amp; "//" &amp;amp; name &amp;amp; "//" &amp;amp; "Sta" &amp;amp; Format(Station, "0.00")
        Set oSta = oDoc.selectSingleNode(alignName)
        Debug.Print Err.Number
        name2 = oSta.baseName
        If name2 &amp;lt;&amp;gt; "" Then
            Read_XMLStation oSta, Xtemp
            read_rec_fromXML = True
        End If
    End If
End If
End Function
Public Function delete_begin_end(events As String) As Boolean
Dim oDoc As DOMDocument
Dim oAlg As IXMLDOMNode, nodes As IXMLDOMNode
Dim oSta As IXMLDOMElement
Dim oLat1 As IXMLDOMElement
Dim oLat2 As IXMLDOMElement
Update_station = False

Set oDoc = Nothing
Set oDoc = New DOMDocument
oDoc.async = False
Err.Clear: On Error Resume Next
oDoc.Load (fXMLFile)
If Err.Number = 0 Then
    oDoc.resolveExternals = True
    If oDoc.parseError = 0 Then
        Dim alignName As String
        Dim x As Integer, name As String, name2 As String
        name = Replace(algname, " ", "_")
        alignName = "//Project_" &amp;amp; CStr(Project) &amp;amp; "//" &amp;amp; name
        Set oAlg = oDoc.selectSingleNode(alignName)
        Set oSta = oAlg.firstChild
        While oAlg.nextSibling &amp;lt;&amp;gt; oAlg.lastChild
            Select Case events
            Case "Begin"
            If oSta.getAttribute("Event") = "Begin Construction" Then
                oAlg.removeChild oSta
            End If
            Case "End"
            If oSta.getAttribute("Event") = "End Construction" Then
                oAlg.removeChild oSta
            End If
        End Select
        Set oSta = oAlg.nextSibling
        Wend
    End If
End If
End Function&lt;/MTUERSLEY&gt;</description>
      <pubDate>Mon, 26 Apr 2004 13:15:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012241#M55034</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-26T13:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Removing 1 item from a dynamic array?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012242#M55035</link>
      <description>Thanks David, for that sample.
I'll be studying that as soon as i dig out from under this pile of work!
Mark

"David Urban" &lt;DURBAN&gt; wrote in message
news:408d0afd$1_2@newsprd01...
&amp;gt; I wrote an XML reader and writer that uses the parser. It uses a simple
&amp;gt; file that I save my UDT to and load my UDT from each time.  I found
&amp;gt; documentation on how to use an XML file in VB very sparse.  Thanks MS.
&amp;gt; I have attached my file.&lt;/DURBAN&gt;</description>
      <pubDate>Thu, 29 Apr 2004 13:46:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/removing-1-item-from-a-dynamic-array/m-p/1012242#M55035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-29T13:46:05Z</dc:date>
    </item>
  </channel>
</rss>

