Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Created 2 Excel file???

Author  Topic 

cyclone9
Starting Member

1 Post

Posted - 2008-09-08 : 00:13:57
Hi,

I create DTS 2000 package but it come out with 2 Excel file.

DTS Design : http://img363.imageshack.us/my.php?image=75891081fx7.jpg
1. ActiveX SCript to create Excel with timestamp
2. Create Table 'Redemption' in Excel
3. Connection from Database
4. Output the Excel

ActiveX Script

Function Main()

Dim appExcel
Dim newBook
Dim oSheet

dim oPackage
dim oConn

Set appExcel = CreateObject("Excel.Application")
Set newBook = appExcel.Workbooks.Add
Set oSheet = newBook.Worksheets(1)

'Specify the name of the new Excel file to be created

DTSGlobalVariables("fileName").Value = "C:\Redemption_" & Year(Date) & Right("0" & Month(Date), 2) & Right("0" & Day(Date), 2) &".xls"

With newBook
.SaveAs DTSGlobalVariables("fileName").Value
.save
End With

appExcel.quit

'dynamically specify the destination Excel file

set oPackage = DTSGlobalVariables.parent
set oConn = oPackage.connections(2)
oConn.datasource = DTSGlobalVariables("fileName").Value

set oPackage = nothing
set oConn = nothing

Main = DTSTaskExecResult_Success

End Function



   

- Advertisement -