Skip to content

*.dannyg

an extension of dannyg

Menu
  • Home
  • art
  • inspiration
  • music
  • poetry
  • Recipes
  • writings
Menu

VBScript Array

Posted on July 20, 2009

Pretty neat script I wrote that allowing preserving an array by cloning it.

Function AddToArray(ArrayToClone, ValueToAdd)
Dim a, tempArray
    On Error Resume Next
    ReDim tempArray(UBound(ArrayToClone) + 1)
    If Err.Number = 0 Then
        For a = LBound(ArrayToClone) To UBound(ArrayToClone)
            tempArray(a) = ArrayToClone(a)       
        Next
    ElseIf Err.Number = 13 Then       
        Err.Clear
        ReDim tempArray(0)
    Else
        WScript.Echo Err.Number
    End If
    tempArray(UBound(tempArray)) = ValueToAdd       
    AddToArray = tempArray
End Function

Technorati Tags: vbscript,arrays

Leave a Reply

You must be logged in to post a comment.

Recent Posts

  • Reading Room
  • Inspirational Movies / TV shows
  • Remove passphrase from PEM file
  • Parallels Multihoming a CentOS Server
  • Forced Failures

Archives

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2026 *.dannyg | Design: Newspaperly WordPress Theme