• Replace the code in the  ActiveX Script with this:

    '**********************************************************************
    '  Visual Basic ActiveX Script
    '************************************************************************
    
    
    Function Main()
        Dim filePreFix, folderName, fileName
    
        folderName = DTSGlobalVariables("FileFolder").Value
        filePreFix = DTSGlobalVariables("FilePrefix").Value
    
        'Call the function, passing in the two Global Variables obtained above.
        fileName = TodaysFile(folderName, filePreFix)
        DTSGlobalVariables("FileName").Value = fileName
    
        If DTSGlobalVariables("FileName").Value <>  "" Then
            Main = DTSTaskExecResult_Success
        Else
            Main = DTSTaskExecResult_Failure
        End If
    
    End Function
    
    '----------------------------------------------------------------------
    Function TodaysFile(MyFolderName, MyFilePrefix)
    '----------------------------------------------------------------------
        Dim myFSO, HighestDate, MyResultName, myFolder, file
        Set myFSO = CreateObject("Scripting.FileSystemObject")
    
        Set myFolder = myFSO.GetFolder(MyFolderName)
        MyResultName = ""
        
        HighestDate = dateAdd("s",-1,Date & " 00:00:00")
            For Each file In myFolder.files
            'Check to make sure the file starts with the right stuff
            If UCase(Left(file.name,Len(MyFilePrefix))) = UCase(MyFilePrefix) Then
                'Check last modified date
                If file.DateLastModified > HighestDate Then
                    MyResultName =  file.path
                    HighestDate = file.DateLastModified
                End If
            End If
        Next
        TodaysFile = MyResultName
        Set myFSO = Nothing
    End Function
    
    
    


    HTH

    Dave Jackson


    http://glossopian.co.uk/
    "I don't know what I don't know."