Solved

Dependencies not found

Posted on 2011-09-29
1
147 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
[X]
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
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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