The very last line int the script:
Lines = sortArray( Lines )

  ----- Original Message -----
  From: Jeff Bishop
  To: [email protected]
  Sent: Thursday, February 04, 2010 2:22 AM
  Subject: RE: Please help - why does this not work?


  What line number do you get the error on?



  From: David [mailto:[email protected]]
  Sent: Wednesday, February 03, 2010 6:04 PM
  To: Scripting List WE
  Subject: Please help - why does this not work?



  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.
  The Professional version does not have this message.


--
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