Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reference Libraries (VB.Net 2003)

    I am trying to reference an Automation Library

    I am using VB.Net 2003 trying to tie into Excel reference library. When I get into the com section of the Add Reference dialog box I have Microsoft
    Excel 11 Object Library and the 5. I select the 11. Then Excel and Microsoft.Office.Core are shown in the Solutions window under the references.

    I then created a button and added this code to the click event.
    Dim objExcel As New Excel.Application
    objExcel.Visible = True

    Excel.Application is marked with the blue line. States it hasn't been declared. The book I am referencing doesn't say I need to do anything else.

    If I go into the Object Brower I do see Microsoft.Office.Interop.Excel and under that there is the Application object.

    Does anyone have an idea? Thank you for your time.

    Fay

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reference Libraries (VB.Net 2003)

    In the list of References in the Solution window, select each library and check the path property to see whether you are referencing the assembliy in the GAC.
    If not, the libraries are not installed correctly.

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reference Libraries (VB.Net 2003)

    Thanks for responding Harold. Checking the properties I found this for Excel
    C:WINDOWSassemblyGACMicrosoft.Office.Interop.Excel 11.0.0.0__71e9bce111e9429cMicrosoft.Office.Interop .Excel.dll
    As this for Microsoft.Office.Core
    C:WINDOWSassemblyGACOffice11.0.0.0__71e9bce111e942 9cOffice.dll

    So it appears to be accessing the GAC correctly.
    Any other ideas?

    Fay

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reference Libraries (VB.Net 2003)

    Hi Fay,

    It sounds like your references are correct. The problem appears to be more simple: You need to explicitly reference the entire path to the Excel object OR use an Imports line to add the object to your intellisense.

    I'm not sure of the entire object "path" but you'll be able to tell once you start typing... It should be something like Microsoft.Office.Core.Excel.Application

    OR you can add this line at the very top of the module: Imports Microsoft.Office.Core
    Then you should be OK to simply type Excel.Application below.

    Hope this helps!

  5. #5
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reference Libraries (VB.Net 2003)

    Thanks Mark. There was no instructions in the book Teach Yourself book saying I needed to do that.

    I seem to have a bigger problem. Last night I uninstalled and reinstalled Office 2003 Professional and InfoPath. When I looked at the references listed in the Reference section in the Solution window there is a yellow explanation by the Microsoft.Office.Core reference. Looking at the properties the path is empty. Looking in Explorer there is no GAC folder. When installing I did a FULL install to the computer. Now I will have to figure out how to install just the GAC folder.

    Fay

  6. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reference Libraries (VB.Net 2003)

    You should not need to worry about the GAC folder for this purpose.

    Remove the reference with the Exclamation point (to Excel or Office, I assume), then re-add the reference. The reference(s) you need should be listed in the COM tab of the References dialog. It's pretty normal to have to remove and re-add references after making this kind of updates - no worries!

    Hope this helps!

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reference Libraries (VB.Net 2003)

    When one re-installs Office, or even just downloads Office Updates, it is necessary to re-install the GAC.

    THis is stated in the Readme file for VS.NET, not sure where else.

    It's a pain in th back rank, to use polite chess terminology.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •