|
-
Mar 23rd, 2000, 06:26 AM
#1
Thread Starter
Lively Member
Hello everyone,
I made a simple little app to start me off making a program to get rid of Happy99.exe from some of my friends' PCs. One of the little functions I wanted this program to perform was to check the liste.ska file that stores the e-mail addresses for all of the people that the trojan has been sent to. It's just a text file, and I used "C:\users\webs.txt" to test. So in the little app I made I added a richtextbox, made a referrence to "Microsoft Scripting Runtime" and wrote the code, and it worked. I tried it later and it didn't. I rewrote it and it still didn't work - the reason being some bizarre Runtime error - 91 - object variable or with block variable not set...here's the code:-
Dim FSys As FileSystemObject
Dim InStream As TextStream
Private Sub cmdRead_onClick()
Set InStream = FSys.OpenTextFile("C:\users\webs.txt")
rtbText.Text = InStream
End Sub
Now I'm probably totally missing the plot here and someone's going to come along and tell me so, but it's the
"Set InStream = FSys.OpenTextFile("C:\users\webs.txt")" line that's causing the problems and I don't know why.
Any help would be greatly appreciated :-)
Thanx
Sam
-
Mar 23rd, 2000, 07:11 AM
#2
Hyperactive Member
Hi, Sam.
Did you set the Reference to Microsoft Scripting Runtime?
Larisa
-
Mar 23rd, 2000, 07:14 AM
#3
Thread Starter
Lively Member
-
Mar 23rd, 2000, 07:29 AM
#4
Hyperactive Member
Hi, Sam.
I took a sample code from Microsoft and modified a little, it doesn't give me any errors.
Private Sub Command1_Click()
Dim fso As New FileSystemObject
Dim ts As TextStream
Set ts = fso.OpenTextFile(Environ("windir") & "\system.ini", ForReading)
Do While Not ts.AtEndOfStream
RichTextBox1.Text = ts.ReadAll
Loop
ts.Close
End Sub
Larisa
-
Mar 23rd, 2000, 07:41 AM
#5
Thread Starter
Lively Member
Thank you!!!
Larisa,
just as I was getting ready to shoot myself in the head when I couldn't work out the differences between the declarations made by you and Microsoft and those made by me to begin with. Then I noticed that I'd written:
Dim FSys As FileSystemObject
instead of
Dim FSys As New FileSystemObject
as you had written.
This pleases me no end since my Happy99 cure is now complete!!!
Thank you soooo much for all your help,
Sam :-D
-
Mar 23rd, 2000, 07:43 AM
#6
Hyperactive Member
Sam, you are very welcome!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|