Solved

Dependencies not found

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

19 Experts available now in Live!

Get 1:1 Help Now