The GW-Scripting list is a discussion list for information regarding the development and use of Window-Eyes scripts. Any subscriber of the GW-Scripting list has the ability to post on-topic messages.

From:

 Jeff Bishop

Subject:

 RE: Please help - why does this not work?

Date:

 Wed, Feb 3, 2010 8:22:31 pm
charset="US-ASCII"

What line number do you get the error on?



From: David [mailto:elephant@tele2.no]
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 ) = 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.