Variable uses an Automation type not supported in VBScript

  • I get this error when I execute an ActiveX script.  Here is the offending line of code:

    If intFileCount <> intExpectedFileCount then

    Here is the code where these variables are referenced:

    Dim intFileCount

    intFileCount = 0

    intFileCount = intFileCount + 1

    Dim intExpectedFileCount

    intExpectedFileCount = DTSGlobalVariables("ExpectedFileCount")

    The Global variable intExpectedFileCount is defined as type int with an initial value of 39.

    Do I have to explicity CAST the global variable?  I fail to see where the Automation type is but, then again, I'm not that experienced in VBScript.

    TIA,

    Mike

  • 2 options.

    1) Change the data type of the global variable from Int to Integer.

    2) Replace your code with this:

    intExpectedFileCount = CInt(DTSGlobalVariables("ExpectedFileCount"))

  • I have seen this error when you attempt to set a VBScript variant to a SQL Decimal without explicitly converting it to a Double.  HTH

Viewing 3 posts - 1 through 2 (of 2 total)

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