Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 and FileSystemObject

Status
Not open for further replies.

johnlopez2000

Programmer
Aug 2, 2002
90
US
I am attempting to use the FileSystemObject to manipulate some files.

However, VB6 does not seem to recognize the FileSystemObject. The compiler complains that:
"User defined type not defined"

for the statement:
Dim FS As New FileSystemObject

Alternately, the Scripting FileSystemObject does seem to work:
Dim Compname As String, FilName As String
Dim fil As Object

Compname = "testfile"
FilName = "c:\temp\" + Compname + ".txt"
Dim fso, txtfile
Set fso = CreateObject("Scripting.FileSystemObject")
Set fil = fso.CreateTextFile(FilName, True)
...

Have I not or do I need to, refenence some library? or load some DLL or declare some function? How would I do that?

thanks


John Lopez
Enterprise PDM Architect
john.l.lopez@goodrich.com
 
You need to reference the 'Microsoft Scripting Runtime' object in the References.

You will then see the FileSystemObject in the Object Browser.
 
Reference Microsoft Scripting Runtime.

Swi
 
Click on "Projects" then "REferences" then select "Microsoft Scripting Runtime
 
You need to add the "microsoft Scripting Reference" to the project.

Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
Sorry madlarry. You were faster than me! :)

Swi
 
swi

And I was slowest of all!

Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
Although it is nice to see that so many people are willing to help.

Swi
 
you'all are way too kuwl - thanks!!!

works okidoki!!!

~(;-}}


John Lopez
Enterprise PDM Architect
john.l.lopez@goodrich.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top