|
-
June 30th, 2007, 04:22 PM
#1
[RESOLVED]Not using VB6 for 1.5 years has made me weak
I'm trying to remember how to read in a text file, without using the FSO's.
This is actually for an Excel VBA macro, and I don't want to have to install the anything on the user's system, other can copying an Excel file.
I'm able to open the file and read all of the test names in just fine.
The file basically looks like this
Test1
Test2
Test3
Those names are actually much longer and proprietary, but these will do for the example.
This is what I've started with, but it's not working.
List of tests looks like this "test1 test2 test3"
each test name is separated by a vbCr
Code:
Private Sub SeparateTestnames(listofTests As String)
Dim newtest As clsTestDescription
Dim curTest As String
Dim startLoc As Long
Dim endLoc As Long
curTest = ""
startLoc = 1
Do
endLoc = InStr(startLoc, listofTests, vbCr, vbTextCompare)
Set newtest = New clsTestDescription
curTest = LTrim(Mid$(listofTests, startLoc, endLoc))
newtest.letTestname = curTest
colAlltests.Add newtest ' this collection is defined in class initialize
startLoc = endLoc + 1
Loop Until (startLoc >= Len(listofTests))
End Sub
The call to Mid$ is returning Test1 Test2
on the same line.
I want to parse each test name separately, then stick one test name into the class, and that class into a collection.
Am I very far off?
thanks
Last edited by cappy2112; July 2nd, 2007 at 03:33 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|