Results 1 to 4 of 4

Thread: ActiveX

  1. #1
    Join Date
    Sep 2003
    Location
    New York, NY
    Posts
    136

    Unanswered: ActiveX

    I have to put some ActiveX code in the first step of a DTS package, which will search thru all the files in some folder and if it finds a file with filename starting with "Test" (like TestFile.txt), the script will rename it and then use it for transforming data to SQL tables.

    In VB Dir$ function could have been used, what should I use in ActiveX?

    Thanks a lot for your help

  2. #2
    Join Date
    Sep 2003
    Posts
    364
    I'm not sure how to rename the file but you might be able to use the xp_fileexist extended proc to see if the file is in the directory.

  3. #3
    Join Date
    Aug 2003
    Posts
    39
    This is a start:



    Function Main()

    Dim objFSO
    Dim objFolder
    Dim objFile
    Dim fileName
    Dim folderName


    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.GetFolder("\\server\share$\dir\")
    folderName = "\\server\share$\dir\Archive\" & Month(Now) & Day(Now) & Year(Now) & "_" & Hour(Now) & Minute(Now) & Second(Now) & "\"


    For Each objFile in objFolder.Files

    objFSO.CreateFolder(folderName)

    fileName = objFile.Path

    objFSO.MoveFile fileName, folderName
    Next

    Main = DTSTaskExecResult_Success

    End Function

  4. #4
    Join Date
    Sep 2003
    Location
    New York, NY
    Posts
    136
    Now I'm getting what I need to do, thanks a lot for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •