• Thanks Craig,

    I am now getting data typeing errors and it is the one thing that really frustrates me with integration into databases. I love the data types in DB's and know them pretty well, but I do struggle with Excel and VBA.

    The filepath variable is the full quailified path,

    So this is what I have now using your piece of code, and I think the modifications are correct.

    ' Microsoft SQL Server Integration Services Script Task

    ' Write scripts using Microsoft Visual Basic 2008.

    ' The ScriptMain is the entry point class of the script.

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Runtime

    Imports System.IO

    <System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _

    <System.CLSCompliantAttribute(False)> _

    Partial Public Class ScriptMain

    Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase

    Enum ScriptResults

    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success

    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure

    End Enum

    Public Sub Main()

    Dim filepath As String

    filepath = Dts.Variables("User::FileName").Value.ToString 'Modified here to use my variable name

    Dts.Variables("User::FileDate").Value = File.GetCreationTime(filepath) 'Modified here to use my variable name

    Dts.TaskResult = ScriptResults.Success

    End Sub

    End Class

    I get the error message as below

    Error: 0xC001F009 at Package: The type of the value being assigned to variable "User::FileDate" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.

    Error: 0xC001C012 at Process Case Files: ForEach Variable Mapping number 2 to variable "User::FileDate" cannot be applied.

    The variable FileName has a data type of string and the variable FileDate has a data type of DateTime. I beleive I am missing a level of casting somewher, but where>

    Sorry to be such a newbie.:unsure:

    Mark