StringList2Array
This function takes string lists as input parameters and returns them as an array.
The function provides all list values as strings, keeps the existing field and row order and provides an array containing all fields and rows.
Compatibility
Available as of IDEA version 10.0
Syntax
StringList2Array()
Example
Option explicit
Sub Main()
On Error GoTo erh
Dim cmds As Object
Dim ar As Variant
Dim ar2 As Variant
Dim s As String
Dim objFile As Object
Dim objText As Object
Dim text As String
Set objFile = CreateObject("Scripting.FileSystemObject")
Set objText = objFile.OpenTextFile("full path file")
text = objText.ReadAll
'msgbox text
objText.Close
Set cmds = SmartContext.SimpleCommands
' the 1st param: the content of a file
' the 2nd param: the column separator
' the 3rd param: the row separator
ar = cmds.StringList2Array (text, "\t", Chr(10))
s = ""
' msgbox lbound (ar) & "," & ubound (ar)
For each ar2 in ar
s = s & ar2(0) & "," & ar2(1) & "," & ar2(2) & "," & ar2(3) & ";"
Next
Exit Sub
erh:
MsgBox "error" & erh.description
End Sub