locked
Interop.Excel works on VS 2010, but not on VS 2012 RRS feed

  • Question

  • Hello,

    On VS 2010 + SP1 the code below works.   On VS 2012, I get this error:

    COMException was unhanled by user code - Error 80040154

    Imports System.Runtime.InteropServices
    Imports Excel = Microsoft.Office.Interop.Excel
    
    (Method code below)
    Dim xlApp as Excel.Application
    
    xlApp = New Excel.Application  '<-- Exception line

    Thanks for any ideas,

    Tom


    MisterT99

    Friday, November 30, 2012 10:12 PM

Answers

  • This works on VS 2012 RC

    Imports System.Runtime.InteropServices
    Imports Excel = Microsoft.Office.Interop.Excel ' Add reference Assemblies -> Extenstions -> Microsoft.Office.Interop.Excel
    Public Class Form1
    
        Dim xlApp As Excel.Application
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            xlApp = New Excel.Application
        End Sub
    End Class


    You've taught me everything I know but not everything you know.


    • Edited by Mr. Monkeyboy Saturday, December 1, 2012 9:13 AM
    • Marked as answer by Mister T99 Saturday, December 1, 2012 5:04 PM
    Saturday, December 1, 2012 3:39 AM