>Has anyone been using the DTS object model to automate DTS? I need to get a
>reference to an existing Package to make some modifications to it via Visual
>Basic. I don't see any methods of the Package object which would allow me
>to load one or to set a reference to one in my code. The SQL Magazines have
>been having a series on automating DTS with VB but they only discuss setting
>up the entire DTS with VB not modifying an existing one.
>Any help would be greatly appreciated. If I figure it out I will be sure to
>Michael Edwards, MCSD
You need to load the package, and then edit properties accordingly
There are some samples in the MSSQL7\DevTools\Samples\DTS\ or on the CD.
Some sample code
Dim oPKG As DTS.Package
Set oPKG = New DTS.Package
oPKG.LoadFromSQLServer "SERVER", "USERNAME", "PASSWORD", _
DTSSQLStgFlag_Default, , , , "Packagename"
oPKG.LoadFromSQLServer "SERVER", , , _
DTSSQLStgFlag_UseTrustedConnection, , , , "Packagename"
This loads a package from SQLServer and prints the number of Global
variables it has. Not very exciting I grant you, but it demonstrates the
use of the package object.
Repository packages are a bit more dificult because you can't use the
name, you must use the GUID instead. See LoadFromRepository method in
If anyone knows how the get a Package GUID from a package name them
please let me know.
All of the objects etc are documented in BOL, but I assume you already
(You have got the reference to the DTSPackage Object Library in your