Solved

Dependencies not found

Posted on 2011-09-29
1
144 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 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