Dr_No Master Cheater
Reputation: 0
Joined: 03 Oct 2008 Posts: 352 Location: Crab Key
|
Posted: Mon Dec 01, 2008 4:25 pm Post subject: [VB6] FileSystemObject Compile Error |
|
|
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.
_________________
|
|