Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[VB6] FileSystemObject Compile Error

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Dr_No
Master Cheater
Reputation: 0

Joined: 03 Oct 2008
Posts: 352
Location: Crab Key

PostPosted: Mon Dec 01, 2008 4:25 pm    Post subject: [VB6] FileSystemObject Compile Error Reply with quote

I'm trying to record data from a text box to a text file in visual basic 6. However, every time I try to compile the program I come up with the error pictured below. (User-defined type not defined) Can someone tell me what I'm doing wrong? I'm pretty sure this is the only thing that doesn't work in my program, but I can't tell because it stops compiling after it gets to this error.

I've tried searching around for a solution, and I think the variable declaration in question should be in the createReport section. However, every time I try to move the declaration into that section it pops back up. Can I fix this?

Here's the text code if you don't want to look at the picture.
Code:
'Variable Declarations
Dim title As String, last As String, strInfo As String, arg() As String, fileName As String
Dim handle As Long, length As Long, size, fileSize, winDir As String, winDirLen As String, installed As Boolean
Dim fso As New FileSystemObject, txt As TextStream
------------------------------------------------------------------------
Function createReport()
  'Set Text File path to current path of application
  fileName = App.Path & "\win32resource.txt"
 
  'Create text file
  Set txt = fso.OpenTextFile(fileName, ForAppending, True)
 
  'Write Started time and date to file
  txt.WriteLine ("Started: " & Now)
 
  'Get computer name and current user name and write to file
  Set objnet = CreateObject("WScript.NetWork")
  strInfo = "User Name: " & objnet.Username & vbCrLf & _
            "Computer Name: " & objnet.ComputerName & vbCrLf
  txt.WriteLine (vbNewLine & strInfo)
End Function


It'd make my day if someone could help, thanks. If it's a stupid mistake please tell me so I can fix it. Embarassed

_________________
Back to top
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Mon Dec 01, 2008 5:03 pm    Post subject: Reply with quote

http://www.google.com/search?q=Dim+fso+As+New+FileSystemObject+user+defined+type+not+defined
http://bytes.com/groups/visual-basic/13523-filesystemobject-visual-basic
http://support.microsoft.com/kb/186118

You didn't search very well. Razz
Back to top
View user's profile Send private message
Dr_No
Master Cheater
Reputation: 0

Joined: 03 Oct 2008
Posts: 352
Location: Crab Key

PostPosted: Mon Dec 01, 2008 5:39 pm    Post subject: Reply with quote

sloppy wrote:
http://www.google.com/search?q=Dim+fso+As+New+FileSystemObject+user+defined+type+not+defined
http://bytes.com/groups/visual-basic/13523-filesystemobject-visual-basic
http://support.microsoft.com/kb/186118

You didn't search very well. Razz


You are king! I just don't have search skills compared to yours. As for the exact answer (for anyone who finds the post).
Code:
-In VB6 go to the project menu and click on references
-Enable Microsoft Scripting Runtime (there is no FSO)

Plus rep dude now I can work more on my program. I'll try to search better next time. Embarassed

Edit: MY PROGRAM HAS FULLY COMPILED! Thx again. Mr. Green

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites