ActiveX component can't create object -
08-17-2006
, 06:30 AM
Hi,
I'm hoping someone can help me with an error message i get in a bit of
VBScript within a DTS Package.
The error message says:
"ActiveX component can't create object : 'Dir2.Dir'
I'm using SQL Server 2000 and this bit of code has been taken from a
colleague (who is now on holiday). I am not terribly familiar to
VBScript, but nevertheless the "Dir2.Dir" does look very odd to me -
i'm not sure what type of object is trying to be created. Does anyone
know what this might be?
The full code is below:
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Function Main()
DIM objImportSearch
DIM SearchPath
Dim SearchFileName
Dim objDir
SET objImportSearch = CreateObject("Scripting.FileSystemObject")
SET objDir = CreateObject("Dir2.Dir")
SearchPath = "C:\FTP Import"
SearchFileName = "*.*"
objDir.Path = SearchPath
objDir.SearchFilename = SearchFileName
objDir.GetFileName
If objDir.FilenameFound <> "" then
'' If objImportSearch.FileExists(SearchPath & "\" & SearchFileName)
then
''-------------------------------------------------------------------------------------------------
'' Set Global IMPORT FILENAME Variable
''-------------------------------------------------------------------------------------------------
DTSGlobalVariables("ImportFileName").Value = objDir.FilenameFound
Main = DTSTaskExecResult_Success
Else
Main = DTSTaskExecResult_Failure
End If
End Function
Regards,
Chris |