fso.writeline not found

Posted on 2009-02-08
Last Modified: 2013-12-08
Hi, I am trying to write a simple text file in VB6, using thr FSO.  I am using the code below (found in Experts-exchange).
The problem is that my oTS class doesn't have the Writeline (or Close) methods defined.  Am I using the incorrect reference?
I have included the Microsoft Scripting Runtime (scrrun.dll) in my references.

Thanks a lot
Dim ReportDir As String

        ReportDir = "C:\test"


        Dim oFSO As New Scripting.FileSystemObject

        Dim oTS As Scripting.File

        Dim strRetp As String


        Set oTS = oFSO.CreateTextFile(ReportDir & "\myfile.txt", ForWriting, True)


      '  oTS.WriteLine "text"



        Set oTS = Nothing

Open in new window

Question by:simb11
    LVL 25

    Accepted Solution

    oTS should be declared as Scripting.TextStream

    Author Closing Comment

    Thank you, Reb73.  Thanks also for the fast response.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    "Disruption" is the most feared word for C-level executives these days. They agonize over their industry being disturbed by another player - most likely by startups.
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now