URGENT!!! - Create a text file in VB SCRIPT

I already know how to create a simple text file in normal Vb6.

What I need to know is what is the code for creating a file in VB SCRIPT.

VB6 Code....

Open "Textfile.txt" For Output As #99
print #99,"Simple Text File"
Close #99

This code will create and edit the fiel Textfile.txt Can anybody tell me what I need to do to make this work for VB SCRIPT

I need to do this today so if any body can help Guarnteed Grade A Answer!!!
LVL 2
RussellMartinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
Hi RussellMartin,

VBScript doesn't support the native file functions of VB. You need to use the FileSystemObject:

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set a = fso.CreateTextFile("c:\testfile.txt", True)
    a.WriteLine("This is a test.")
    a.Close


Tim Cottee MCSD, MCDBA, CPIM
http://www.timcottee.tk 

Brainbench MVP for Visual Basic
http://www.brainbench.com

Experts-Exchange Advisory Board Member
0
RussellMartinAuthor Commented:
Now I get an error activex object cant be created

any ideas
0
RussellMartinAuthor Commented:
Now I get an error activex object cant be created

any ideas
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

itzmeCommented:
You need to include the reference Microsoft Scripting runtime:
choose References from the Project menu), select Microsoft Scripting Runtime (SCRRUN.DLL)
you'll have to declare the fso variable
Dim fso As New fileSystemObject
0
itzmeCommented:
You need to add the reference "Microsoft Scripting Runtime"
from the References dialog in the Projects menu.
Also declare fso in the code given by tim after including the reference:
Dim fso As New fileSystemObject
0
aelatikCommented:
Start > Run > REGSVR32 C:\WINNT\SYSTEM32\SCRRUN.DLL
0
Richie_SimonettiIT OperationsCommented:
There is no problem with reference, You are creating object at runtime so Refrence is not required.
But, it could be that sccrun.dll is not installed in target machine or not properly registered.
If you try to run that code from internet, maybe that could not work.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CleanupPingCommented:
Hi RussellMartin,
This old question (QID 20554626) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
GPrentice00Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

-->Split between TimCottee and aelatik

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

GPrentice00
EE Cleanup Volunteer
0
Richie_SimonettiIT OperationsCommented:
ups!, what happens here?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.