Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Dependencies not found

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

839 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