Directlinq
Registered User.
- Local time
- Yesterday, 21:36
- Joined
- Sep 13, 2009
- Messages
- 67
CAn anybody tell me why this code is giving me an error
It saying subscript out of range on the
line.
All this code does is reads the text file and splits the text into 2 strings and removes a character.
Many Thanks
Code:
' Open a text file for input. inputbox returns the path to read the file
Open Environ("USERPROFILE") & "\Desktop\text.txt" For Input As nFileNum
lLineCount = 1
' Read the contents of the file
Do While Not EOF(nFileNum)
Line Input #nFileNum, sNextLine
sText = sNextLine
strData() = Split(sNextLine, " – ")
artist = Trim(strData(0))
artist = Replace(artist, "# ", "")
songname = Trim(strData(1))
It saying subscript out of range on the
Code:
songname = Trim(strData(1))
All this code does is reads the text file and splits the text into 2 strings and removes a character.
Many Thanks