I have a program that is designed for Flash Debugging that I have been working on. The code that is not working is as follows:

Code:
Private Sub Command13_Click()
Dim x As Long
Dim var9 As String
    Open "found.txt" For Output As #12     'This is becuase, rarely, it will not touch the "found.txt" file at the end of this sub when there are no varibs found.
        Print #12, "No Variables Found"
    Close #12
        Command13.Enabled = False          ' Disable the button to prevent user rage when the program stops responding :P
        Open "words.txt" For Input As #9
        While Not EOF(9)
            Line Input #9, str
            List1.AddItem Trim(str)
        Wend
        Close #9                           ' Adds all the words in "words.txt" into listbox1. This whole sub is essentially a dictionary attack on a flash movie
        x = 0
        While x < List1.ListCount
            On Error Resume Next
            var9 = Flash.GetVariable(List1.List(x)) 'Goes through all the variables in listbox1 and trys to get them from the flash movie.
            If var9 = "" Then List2.AddItem List1.List(x) 'if there are any found, it puts them into listbox2
            x = x + 1
        Wend
    Open "found.txt" For Output As #10
        Dim i As Long
        For i = 0 To List2.ListCount
            Print #10, List2.List(i)        'prints all the variables in listbox2 into "found.txt"
        Next i
    Close #10
    Form2.Visible = True     'all form2 does is load the found variables into a listbox
    Exit Sub
End Sub
Instead of printing all of the found variables to "found.txt", it prints the first 2000 or so words of "words.txt" into it. I can not see what my error is, maybe the great internet can save me here.

As I say in the comments, the whole sub is essentially a dictionary attack on a flash movie. I can provide the project files if nessacary.

Thank you.