DTS DTSGloabalVariables Save file in variable Finallocation problem

  • I have made script 1 to generate a file and script 2 to generate the location. The goal is that when the file is created it is moved/saved into the new folder that is created. The problem is I cannot seem to get this to work. I would like to integrate script 2 into script 1 but every attempt so far fails. So can anyone help me out to integrate script 2 for the Finallocation?

    (SQL 2000)

    Script 1

    '**********************************************************************

    ' Visual Basic ActiveX Script

    Function Main()

    Dim fileName

    fileName = "OnlineBilling_" & DatePart("yyyy", Date) & Right("0" & DatePart("m", Date), 2) & Right("0" & DatePart("d", Date), 2) & "_" & Right("0" & DatePart("h",Now), 2) & Right("0" & DatePart("n",Now), 2) & Right("0" & DatePart("s",Now), 2)

    DTSGlobalVariables("FinalLocation").Value = DTSGlobalVariables("NetworkLocation").Value + fileName + ".xls"

    Main = DTSTaskExecResult_Success

    End Function

    Script 2

    '**********************************************************************

    ' Visual Basic ActiveX Script

    '************************************************************************

    Option Explicit

    Function Main()

    Dim objFSO, dNow, yyyy, mt, dd, hh, nn, ss, NewFolder

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    dNow = Now

    yyyy = Right(Year(dNow), 4)

    mt = Right("00" & Month(dNow), 2)

    dd = Right("00" & Day(dNow), 2)

    hh = Right("00" & Hour(dNow), 2)

    nn = Right("00" & Minute(dNow), 2)

    ss = Right("00" & Second(dNow), 2)

    NewFolder = "E:\Online\" & yyyy & "_" & dd & mt & "_" & hh & nn & ss

    'Create the folder

    objFSO.CreateFolder NewFolder

    Set objFSO= Nothing

    Main = DTSTaskExecResult_Success

    End Function

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply