Solved

Dependencies not found

Posted on 2011-09-29
1
143 Views
Last Modified: 2012-05-12
I am trying to reference the Excel. Application object however when I add the dependencies I still get an error on saying type Excel.application is not defined.  All I would like to do is open the selected Excel File in a vb.net application.

Thanks in advance
Private Sub btnXYZFile_Open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnXYZFile_Open.Click
        Me.dlgOpenPartfile.InitialDirectory = _Default_Definition_FileOpen_Dir
        If Me.dlgOpenPartfile.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            '  Opens the target Excel File
            Dim ExcelObj As New Excel.Application
            Me.dlgOpenPartfile.FileName = "*.xls"

        End If
    End Sub

Open in new window

Dependencies.png
0
Comment
Question by:cmdolcet
1 Comment
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 36819009
In .NET, you connect to Excel through an intermediate that has a long namespace. So the code is a little longer than what you might be used to.

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

If you would prefer to stick with the shorter declaration, add the following at the top of the code file:

Imports Microsoft.Office.Interop

Doing this, that namespace becomes one of the defaults (akind to the path environment variable for files) and you do not have to specify it everytime that you use an Office object.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now