Just paste this code into any module (this is the desired way) or form. To do this, open up your project and insert a new Module (or use the one you created for the last issue). Change the name of the module to basStrings and paste this code into the module.
'----------------------------------------------------------------------
'
' Module Name: basStrings
' Written By: C&D Programming Corp.
' Create Date: 11/19/97
' Copyright: Copyright 1997 by C&D Programming Corp. Source
' code may not be reproduced except for use in a
' compiled executable. All rights reserved. If
' you would like to reprint any or all of this
' code please email us at info@codeoftheweek.com
'
' Purpose: Converting a single delimited string into an
' array and vice versa
'
'----------------------------------------------------------------------
Public Sub GenericArrayToString(sData As String, vArray As Variant, ByVal sDelimiter As String)
Dim lLen As Long
Dim x As Long
On Error Goto Handler
' Special Condition when vArray is Null or Empty
If IsNull(vArray) or IsEmpty(vArray) Then
sData = ""
Exit Sub
End If
' Build String
sData = ""
For x = LBound(vArray) To UBound(vArray)
sData = sData & vArray(x) & sDelimiter
Next
' Remove trailing delimiter
lLen = Len(sData)
If lLen > 0 Then
sData = Left(sData, lLen - Len(sDelimiter))
End If
Exit Sub
Handler:
sData = ""
Err.Raise Err.Number, "basStrings.GenericArrayToString", Err.Description
End Sub