FSO in DTS - Property not supported

  • I'm trying to write a ActiveX task that takes a flat file created by a Data Transform and scrubs out all the occurrences of a double double-quote (i.e. "") as well as replacing the string "%%" with " ". I'm getting a "property not supported" error on my first FSO.OpenTextFile statement. I've tried adding "True" as a third operand according to the docs, but that didn't help. Any ideas?

    Assuming "fx" points to the input file and "fi" to the output.

     set fso=createobject("Scripting.FileSystemObject")

     dim inf, outf, dq

     Const ForReading = 1, ForWriting = 2

     dq=chr(34)&chr(34)

     inf=fso.opentextfile(fx,ForReading)     <======== Error here.

     outf=fso.opentextfile(fi,ForWriting)

     dim line

     line=inf.readline

     while line<>""

        while find(line,dq)>0

            line=replace(line,dq,"")

        wend

        while find(line,"%%")>0

            line=replace(line,"%%"," ")

        wend

        outf.writeline line

        line=inf.readline

     wend

     

  • Because inf and outf will be an object (file) itself you need to use SET. Try:

    Set inf = fso.opentextfile(fx,ForReading)

    Set outf = .....



    Ade

    A Freudian Slip is when you say one thing and mean your mother.
    For detail-enriched answers, ask detail-enriched questions...[/url]

  • One of those stupid things you know but don't see when you're looking at the code.

    Thanks.

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply