Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Error importing Excel typelib

Error importing Excel typelib

Scheduled Pinned Locked Moved C / C++ / MFC
c++questioncomhelp
13 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P progDes

    Hi all. I'm using unmanaged C++ MFC application. And I need to get Excel interfaces. As I know I need to import TypeLib using MFC wizzard. Wizzard is creating a header, excel.tlh and excel.tli files. When i start to compile project, there is 100's of errors in excel.tlh. So the question is: what i've done improperly? May be I need to include additional libraries and headers (tried to include ole.h and ole32.lib). May be someone know some articles, where I can find information about it? Thank's a lot

    D Offline
    D Offline
    David Crow
    wrote on last edited by
    #4

    progDes wrote:

    As I know I need to import TypeLib using MFC wizzard.

    Which type library did you use?


    "A good athlete is the result of a good and worthy opponent." - David Crow

    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

    P 1 Reply Last reply
    0
    • D David Crow

      progDes wrote:

      As I know I need to import TypeLib using MFC wizzard.

      Which type library did you use?


      "A good athlete is the result of a good and worthy opponent." - David Crow

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      P Offline
      P Offline
      progDes
      wrote on last edited by
      #5

      im using Excel 11 or 10 typelib (TLB), which is in Excel.exe file

      D P 2 Replies Last reply
      0
      • P progDes

        im using Excel 11 or 10 typelib (TLB), which is in Excel.exe file

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #6

        I just did the same thing (I'm using Excel 2003 whose type library comes from excel.exe) and it works fine. The only files that were created are excel.h and excel.cpp.


        "A good athlete is the result of a good and worthy opponent." - David Crow

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        P 1 Reply Last reply
        0
        • D David Crow

          I just did the same thing (I'm using Excel 2003 whose type library comes from excel.exe) and it works fine. The only files that were created are excel.h and excel.cpp.


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          P Offline
          P Offline
          progDes
          wrote on last edited by
          #7

          The TLH and TLI files creating during compilation when #import is executing. I found step by step microsoft sample, but it doesnt works (at home and on work both Office 2003). What VS do you using. I saw that earlier VS creating h and cpp files, but my VS2005 create only .h

          D 1 Reply Last reply
          0
          • P progDes

            The TLH and TLI files creating during compilation when #import is executing. I found step by step microsoft sample, but it doesnt works (at home and on work both Office 2003). What VS do you using. I saw that earlier VS creating h and cpp files, but my VS2005 create only .h

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #8

            progDes wrote:

            What VS do you using.

            I am using VS6.


            "A good athlete is the result of a good and worthy opponent." - David Crow

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            P 1 Reply Last reply
            0
            • D David Crow

              progDes wrote:

              What VS do you using.

              I am using VS6.


              "A good athlete is the result of a good and worthy opponent." - David Crow

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              P Offline
              P Offline
              progDes
              wrote on last edited by
              #9

              That's the point. Now i'm thinking about finding Excel 5.0 or 9.0 library, may be it can work. I think, i just have bad office on two computers, installed from 1 CD

              D 1 Reply Last reply
              0
              • P progDes

                That's the point. Now i'm thinking about finding Excel 5.0 or 9.0 library, may be it can work. I think, i just have bad office on two computers, installed from 1 CD

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #10

                progDes wrote:

                I think, i just have bad office on two computers...

                Can you try using the "bad" type library with VB?


                "A good athlete is the result of a good and worthy opponent." - David Crow

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                1 Reply Last reply
                0
                • P progDes

                  im using Excel 11 or 10 typelib (TLB), which is in Excel.exe file

                  P Offline
                  P Offline
                  progDes
                  wrote on last edited by
                  #11

                  Yes and its works in VB in managed C++ in C#, and even 5.0 library doesnt work in C++. Something wrong here, what can I do improperly?

                  P 2 Replies Last reply
                  0
                  • P progDes

                    Yes and its works in VB in managed C++ in C#, and even 5.0 library doesnt work in C++. Something wrong here, what can I do improperly?

                    P Offline
                    P Offline
                    progDes
                    wrote on last edited by
                    #12

                    OK, I'll try to list my actions. 1) Creating a ialog based MFC application (other parameters is by default) 2) Add->Class->MFC class from TypeLib The window contains library list and list of classes that can be created. 3) Selecting the _Application class (only 1 for example) and header is CApplication.h 4) OK 5) Run (it works) 6) Include CApplication.h into any file 7) Run (100's of error) in the top of the header there is #import directive. I've reduced error count by changing attributes of it. So, can you list me your attributes, please? -- modified at 11:20 Tuesday 12th June, 2007

                    1 Reply Last reply
                    0
                    • P progDes

                      Yes and its works in VB in managed C++ in C#, and even 5.0 library doesnt work in C++. Something wrong here, what can I do improperly?

                      P Offline
                      P Offline
                      progDes
                      wrote on last edited by
                      #13

                      Ha-Ha!!! Here is the answer. Need to comment the line in header file #import "C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE" no_namespace I dont know why, but when i've commented it the code began work

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups