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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

appending a file in DTS package

Status
Not open for further replies.

fikir

Programmer
Jun 25, 2007
86
0
0
I am trying to append a file to existing text file in DTS and wrote this VB script

Code:
'**********************************************************************
'  Visual Basic ActiveX Script
'************************************************************************

Function Main()
	Dim oFSO
	Dim openFile
        Dim readFile
        Dim finalFile

                         
	Set oFSO = CreateObject("Scripting.FileSystemObject")
	
             finalFile =  oFSO.OpenTextFile("U:\Archive\DestinationFile.txt", ForAppending, True)

	openFile = oFSO.OpenTextFile("U:\Archive\muk", ForReading, True)
              readFile =  openFile.ReadAll()
             
              finalFile.write(readFile)
             
             openFile.close()
             finalFile.close()
             
             oFSO.DeleteFile sSourceFile

	Set oFSO = Nothing

             Main = DTSTaskExecResult_Success

End Function

but it is coplainign that on this line of code

openFile = oFSO.OpenTextFile("U:\Archive\muk", ForReading, True)

it is saying that object doesn't support this property or method

Is there any wrong in my script?

Thanks
 
Hi,

I think the problem may be in the fact that the final "True" parameter indicates that the file will be created if it doesn't exist.

Given that the file is for reading only, this doesn't make sense.

Try removing the final "True"


Hope it helps

Kevin

**************************************************************
Rock is Dead (Long Live Paper and Scissors)
**************************************************************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top