• capturing Excel (Visual Basic)

    Home » Forums » Developers, developers, developers » DevOps Lounge » capturing Excel (Visual Basic)

    Author
    Topic
    #377250

    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?

    Viewing 1 reply thread
    Author
    Replies
    • #620826

      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)

      • #620842

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

        • #620930

          Not sure about 97- but Excel 2000 is on my computer at c:program 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.

    • #621945

      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!

    Viewing 1 reply thread
    Reply To: Reply #621945 in capturing Excel (Visual Basic)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel