I have the following script. Running it, the last line results in a 'type 
mismatch' error. What am I missing?

'Objects
Dim FS: Set FS = CreateObject( "Scripting.FileSystemObject" )

'Variables
Dim Filename, Line
Dim Lines()
Dim Number
Dim Textfile


'Functions
Function SortArray( OldArray() )   'Returns a sorted copy of the incoming Array
Dim EntryNumber, ZZZ
Dim TempEntry
'---Function Code Starts---
  EntryNumber = 0
  Do
   EntryNumber = EntryNumber + 1
   TempEntry = oldArray( EntryNumber -1 )
   If OldArray( EntryNumber ) < TempEntry Then
'doing my sorting operations here...
   End If
  Loop Until EntryNumber >= UBOUND( OldArray )
 SortArray = OldArray
End Function 'SortArray


'---Main Code---
Filename = InputBox( "Name of file to be sorted: ", "Text File Sorting" )
Set Textfile = FS.OpenTextFile( Filename, 1, False )

Number = -1
Do Until Textfile.AtEndOfStream
 Number = Number + 1
 Redim Preserve Lines( Number + 1 )
 Lines( Number ) = Textfile.ReadLine
Loop
Textfile.Close
Set Textfile = Nothing
Lines = SortArray( Lines )


Thanks a whole lot!

--
I am using the free version of SPAMfighter.
We are a community of 6 million users fighting spam.
SPAMfighter has removed 611 of my spam emails to date.
Get the free SPAMfighter here: http://www.spamfighter.com/len

The Professional version does not have this message

Reply via email to