August 14, 2005 at 7:42 am
Hi,
Everything works fine except the last step were I want to delete the txt file I created and uploaded to a remote server.
I placed an ActiveX Script Task and entered the following:
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Dim objFSO
Dim objFolder
Dim objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\temp\")
For Each objFile In objFolder.Files
objFile.Delete True
Next
Set objFile = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
The files do get deleted, but if I am manually running this script from within Enterprise Manager / TDS a window pops up which shows the status of all of packages and shows an error on the deleting task. If I double click on the error the popup says:
AciveX Scripting: Function not found
Any idea what I am missing or what is going on?
If I schedule the task and do not have Enterprise Manager running I obviously do not see the error and everything works fine, the only thing is that I feel weird knowing there is an error somewere.
Thanks,
Mitch
August 14, 2005 at 8:06 am
Silly Me...I guess I should have really read the message. The below code solved the problem:
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
Dim objFSO
Dim objFolder
Dim objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\temp\")
For Each objFile In objFolder.Files
objFile.Delete True
Next
Set objFile = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
Main = DTSTaskExecResult_Success
End Function
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply