none
Visual Studios 2012 VB script task. RRS feed

  • Question

  • I am having an issue with one of my team members Visual Studios 2012 VB script task.

    She no longer can run a Script task that uses Interop.  .  The task basically opens up a excel file (2007) and converts it to 2010 or xls to xlsx. .net 4.5 and Interop 1.7 are loaded on her computer and seems to running fine however when she executes the task she get a preverbal generic Runtime error

     I have trouble shot this to death and just coming up with nothing.  What I can tell is when excel is trying to open on her computer that is when the failure occurs.

    So in the code below when excel.visible = true executes you can see on her task manager excel opening, then the runtime error occurs and the code stops there. 

    There is other code after these so don’t get raped around the “End Sub” “End Class” not being below. I just did not copy all the code, just too where the problem starts to happen.

    For some background her computer was reimaged and Visual Studios was reloaded.  All other tasks are working fine on her computer. Only the one where Interop is involved is not working. 

    What could be possibly causing this? Any help would be greatly appreciated.  Thanks

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Runtime

    Imports Microsoft.Office.Interop.Excel

    <Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute> _

    <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()

            Dts.TaskResult = ScriptResults.Success

            Dim excel As New Microsoft.Office.Interop.Excel.Application

            'Dim wb As Microsoft.Office.Interop.Excel.Workbook

            excel.Visible = True

    • Moved by Youjun Tang Friday, July 24, 2015 6:27 AM more appropriate
    Wednesday, July 22, 2015 4:23 PM

All replies

  • Hi ajolson1964,

    Move to Excel for developer forum for a better support, thanks for your understanding :)

    Best Regards,

    Xavier Eoro


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, July 24, 2015 2:12 AM
  • As mentioned above, more details are needed to determine exactly what is causing the error. Do you try to run this script task in other machine then obtain the same issue?
    >>>So in the code below when excel.visible = true executes you can see on her task manager excel opening, then the runtime error occurs and the code stops there.
    If you try to set excel.visible =false, does the runtime error occur and the code stop there?
    Could you provide your sample code and exception information? That will help us reproduce and resolve your issue.
    Wednesday, July 29, 2015 9:10 AM
  • Thanks for the reply.

    This code is working on all machines but hers.  I have set excel.visible = false and same error.  The only way I get it to work on her devise is to comment out everything in Main with the exception of

          Dts.TaskResult = ScriptResults.Success

          Dim excel As New Microsoft.Office.Interop.Excel.Application


    I even created a new script in C# and it also fails with the same error message, but works on all other machines.  This seems to be surrounding the Interop assemblies.    I am not sure if the version of PowerPoint on her machine may be causing this as it is the only thing that may be different from her machine to all others.  

    I will see if i can get the error code it generates but all the IT guys around here just say it is a a generic error message that is of no real value.  

    Wednesday, July 29, 2015 11:50 AM
  • >>>I even created a new script in C# and it also fails with the same error message, but works on all other machines. This seems to be surrounding the Interop assemblies.

    According to your reply, I suggest that you could create an Excel VSTO project then add the codes which cause this issue on her machine, Do you get any exception when this project is running.
    If you get same exception, I suspect Office PIAs caused this issue. So you need to make sure the referenced DLL's have been added to the GAC on the target machine or reinstall office.

    • Proposed as answer by David_JunFeng Tuesday, August 18, 2015 1:38 AM
    Friday, July 31, 2015 8:04 AM