Excel Fails to Launch Using VB.NET

I use vb.net to launch and use Microsoft Excel.  There is 1 computer, however, that will not launch excel when I run this code:

Imports XL = Microsoft.Office.Interop.Excel

Public Class Form1

    Dim xlApp As New XL.Application
    Dim wb As XL.Workbook
 
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        wb = xlApp.Workbooks.Add()
    End Sub
End Class

I have references to Microsoft.Office.Core and Microsoft.Office.Interop.Excel.  I am using Visual Studio 2015 and the Excel on the user's machine is 2010 Professional Plus.

Please see the attached error.

Thank you,

Elliot Semmelman
error.docx
Member_2_7971199Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieVBA ExpertCommented:
Elliot

What version of Excel Interop are you using?

Also, on the computers where the code works what version of Excel is installed?

What happens if you change to using late binding?
Public Class Form1

    Dim xlApp As Object
    Dim wb As Object
  
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        xlApp = CreateObject("Excel.Application")
        wb = xlApp.Workbooks.Add()
        xlApp.UserControl = True
    End Sub

End Class

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Éric MoreauSenior .Net ConsultantCommented:
does the user has the same version of Office that you have installed?
0
Member_2_7971199Author Commented:
It does work using late binding.  Thank you.

Several Questions:

1)  Does that help to pin point what the problem is?

2)  Is there a significant delay in processing using late binding vs. early binding?

3)  I removed the library reference, can you use all properties and methods using late binding?

Thanks.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Éric MoreauSenior .Net ConsultantCommented:
1) development process can be slowed down because you don't get intellisense
2) somewhat yes but often not noticeable
3) yes but no compile time error. Only run time errors.
0
NorieVBA ExpertCommented:
Elliot

1) It doesn't really 'pinpoint' the problem but it does suggest it could have something to do with different versions being in use.

2) As Éric there might be some slowdown but nothing  noticeable.

3) All properties and methods are still available.
0
NorieVBA ExpertCommented:
Late binding was indicated as a solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.