-
Call a Second Package inside ActiveX Script
Hi,
I have several .xls files in a folder. I want to process all .xls file one by one. The following script will give the file name using a loop. How I can call another package by passing the name of file to it.
Dim objFSO, objFolder, colFiles, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(DTSGlobalVariables("gvFolder").va lue)
Set colFiles = objFolder.Files
If colFiles.Count > 0 then
For Each objFile in colFiles
If Ucase(Right(objFile,4)) = ".XLS" then
' How to call a another Package by Passing the objFile to it
End if
Next
End if
Thanks
-
I had a similar task to do and solved it as follows:
ActiveX Task
1) loop through the input folder and get the names of the files to be processed using file system object (as you do)
2) Write a batch file back to your server with a DTSRUN statement per file found in the input folder passing the file name as a prameter into your loading package
3) add a command line task to your first package which executes the batch file you have just created
-
Thanks for the reply. But this is the way I did it.
Dim objFSO, objFolder, colFiles, objFile
Dim objPackage
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(DTSGlobalVariables("gvFolder").va lue)
Set colFiles = objFolder.Files
If colFiles.Count > 0 then
For Each objFile in colFiles
If Ucase(Right(objFile,4)) = ".XLS" then
Set objPackage = CreateObject("DTS.Package")
objPackage.LoadFromSQLServer ".", "", "", "256" , , , , "ChildPackage"
objPackage.GlobalVariables.Item("gvFileName").valu e = DTSGlobalVariables("gvFolder").value + "\" + objFile.Name
objPackage.Execute
objPackage.Uninitialize()
Set objPackage = nothing
End if
Next
End if
-
Definitely more elegant
But I am a fan of batch programming. Reminds me of the good old non GUI times :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|