Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Aug 2002
    Location
    Brantford, Ontario
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    capturing Excel (Visual Basic)

    I just got Visual Studio.NET and am trying the following:

    Dim objExcel As Excel.Application ' Object variable to capture Excel

    Which fails with the message:

    Type 'Excel.Application' is not defined.

    What am I doing wrong?

  2. #2
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: capturing Excel (Visual Basic)

    Ronald,

    I don't have VB.net installed yet, so I'm not quite sure...

    but, in VB6 you would have to check a reference to the Excel application (in vb6- tools, references- and select Microsift Excel from the list)
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  3. #3
    New Lounger
    Join Date
    Aug 2002
    Location
    Brantford, Ontario
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: capturing Excel (Visual Basic)

    That sounds right but I can't find the dll? file. What would it be called in Office 97?

  4. #4
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: capturing Excel (Visual Basic)

    Not sure about 97- but Excel 2000 is on my computer at crogram FilesMicrosoft OfficeOfficeExcel9.OLB

    It's in the dropdown list (from Tools, Refverences) as "Microsoft Excel 9.0 Object Library"

    Though it's possible .NET does things completely differently.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, UK, Berkshire, England
    Posts
    243
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: capturing Excel (Visual Basic)

    There are some notes about PIA's at
    http://msdn.microsoft.com/library/default....odc_oxppias.asp
    but these are for Office XP

  6. #6
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: capturing Excel (Visual Basic)

    You're close, Ronald. To add a reference to the appropriate library, choose Add Reference from the Project menu. Click on the COM tab, and scroll down to the Microsoft Excel 10.0 Object Library. After you've added it, you should stop seeing the Blue Squiggle of Terror when you type something like:

    Dim oExcel as New Excel.Application()

    I believe you have to have Excel 2002 installed on the machine running VS.NET, though. You can check KB Q328912 for some info on downloading the Primary Interop Assemblies, another acronym for the dyslexicon, to work with Office XP COM libraries. Good luck!
    <font face="Comic Sans MS"><font color=blue>~Shane</font color=blue></font face=comic>

Posting Permissions

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