Someone else mentioned just using a comma delimited text file and pulling
the data in that way. If that is easier then I am not opposed to doing it
that way.
Thanks,
Robbie
Will this help; watch for word-wrap:
Option Explicit
'---------------------------------------------------------------------------
'
' "otfSplit.vbs.vbs"
'
' This VBS (Visual Basic Script) program does the following:
' 1) Reads a file of two fields into two arrays.
'
' To test, either double-click on the filename in Windows Explorer or
' from the Command prompt, type "cscript otfSplit.vbs".
'
' Changes:
-------------------------------------------------------------------------
' 15-Dec-2003.0 Created.
'
'---------------------------------------------------------------------------
'
Const cVBS = "otfSplit.vbs"
Const cOTF = "otfSplit.txt"
'*
'* Start Message
'*
MsgBox Now & ": '" & cVBS & "' started."
'*
'* Declare Variables
'*
Dim arrONE(99)
Dim arrTWO(99)
Dim strARR
Dim intOTF
intOTF = 0
Dim strOTF
'*
'* Declare Objects
'*
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objOTF
Set objOTF = objFSO.OpenTextFile(cOTF,1)
'*
'* Read File
'*
Do While Not objOTF.AtEndOfStream
strOTF = objOTF.ReadLine()
'*
'* Check for one (and only one) separator
'*
If InStr(strOTF,",") > 0 _
And InStr(strOTF,",") <> InStrRev(strOTF,",")Then
WScript.Echo "Invalid input: " & strOTF
WScript.Quit
End If
'*
'* Build Arrays
'*
strARR = Split(strOTF,",")
arrONE(intOTF) = strARR(0)
arrTWO(intOTF) = strARR(1)
'WScript.Echo arrONE(intOTF) & " : " & arrTWO(intOTF)
intOTF = intOTF + 1
Loop
'*
'* Destroy Objects
'*
Set objOTF = Nothing
Set objFSO = Nothing
'*
'* Finish Message
'*
MsgBox Now & ": '" & cVBS & "' finished."
This works fine. I really appreciate it.
Nice coding, by the way. I am pretty new at scripting and I completely
understand everything you are doing.
Thanks so much,
Robbie
"McKirahan" <Ne...@McKirahan.com> wrote in message
news:gAmDb.549936$HS4.4175408@attbi_s01...
You're welcome.
On reflection, I revised some of the code:
'*
'* Check for one (and only one) separator
'*
If InStr(strOTF,",") = 0 _
Or InStr(strOTF,",") <> InStrRev(strOTF,",") Then
This is almost the same as McKirahan's, but Ill post it anyway
Option Explicit
Const ForReading = 1, ForWriting = 2, ForAppending = 8
dim lines, column(), fileData, fso, x, y, lineParts
set fso = CreateObject("Scripting.FileSystemObject")
fileData = fso.OpenTextFile("c:\test.csv",ForReading).readall
lines = split(filedata,vbnewline)
redim column(1,ubound(lines))
for x = 0 to ubound(lines)
lineParts = split(lines(x),",")
column(0,x) = lineParts(0)
column(1,x) = lineParts(1)
next
set fso = nothing
msgbox column(1,2)
How often do you hear that? Nominates Robbie as VBScripting Newbie of the
Year! *roar from the crowd*
Excellent point, Roland.
I've been thanked alot for my help but Robert when above and beyond with his
praise.
Thanks Robert!
No doubt. The rest of us are jealous! (O;=