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. #imports for MS Office2013

#imports for MS Office2013

Scheduled Pinned Locked Moved C / C++ / MFC
questionannouncement
6 Posts 2 Posters 12 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.
  • B Offline
    B Offline
    Bryan Anslow
    wrote on last edited by
    #1

    Hi All, I have a wrapper class for the MS Office Products, last time I built it was way back for Office 2000. I had a set of #imports for that version, but looking in the various directories seem to have changed a bit. This is what I currently use, has anyone got an updated list for MS Office 2013? Thanks,

    #import "C:\Program Files\Microsoft Office\Office\MSO9.DLL"
    #import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
    #import "C:\Program Files\Microsoft Office\Office\MSWORD9.OLB" rename("ExitWindows","_ExitWindows")
    //#import "C:\Program Files\Microsoft Office\Office\EXCEL9.OLB" rename("DialogBox","_DialogBox") \
    // rename("RGB","_RGB") \
    // exclude("IFont","IPicture")
    //#import "C:\Program Files\Common Files\Microsoft Shared\DAO\DAO360.DLL" rename("EOF","EndOfFile")\
    // rename("BOF","BegOfFile")
    //#import "C:\Program Files\Microsoft Office\Office\MSACC9.OLB"

    S 1 Reply Last reply
    0
    • B Bryan Anslow

      Hi All, I have a wrapper class for the MS Office Products, last time I built it was way back for Office 2000. I had a set of #imports for that version, but looking in the various directories seem to have changed a bit. This is what I currently use, has anyone got an updated list for MS Office 2013? Thanks,

      #import "C:\Program Files\Microsoft Office\Office\MSO9.DLL"
      #import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
      #import "C:\Program Files\Microsoft Office\Office\MSWORD9.OLB" rename("ExitWindows","_ExitWindows")
      //#import "C:\Program Files\Microsoft Office\Office\EXCEL9.OLB" rename("DialogBox","_DialogBox") \
      // rename("RGB","_RGB") \
      // exclude("IFont","IPicture")
      //#import "C:\Program Files\Common Files\Microsoft Shared\DAO\DAO360.DLL" rename("EOF","EndOfFile")\
      // rename("BOF","BegOfFile")
      //#import "C:\Program Files\Microsoft Office\Office\MSACC9.OLB"

      S Offline
      S Offline
      SujayG
      wrote on last edited by
      #2

      I think if you generate files from a tlb the paths should automatically come up. This is of Office 2010 #import "C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE12\\MSO.DLL" no_namespace A suggestion : Having developed several Office addins, and if you are also doing so, I shall strongly suggest you to use C# .

      My Blog

      B 1 Reply Last reply
      0
      • S SujayG

        I think if you generate files from a tlb the paths should automatically come up. This is of Office 2010 #import "C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE12\\MSO.DLL" no_namespace A suggestion : Having developed several Office addins, and if you are also doing so, I shall strongly suggest you to use C# .

        My Blog

        B Offline
        B Offline
        Bryan Anslow
        wrote on last edited by
        #3

        Hi Sujayg, I am trying to create a *.lib file to wrap some of the Word Automation Functions. So, tell me if I got this all wrong... I created a Win32 project, selecting MFC and Static Library. I used Add Class -> MFC Class From Typelib and selected File and used C:\\Program Files\\Microsoft Office\\Office15\\MSWORD.OLB As I did not know which classes I would need, I just selected them all. So it generated a lot of Class Header files. I selected a few Header files for the classes I needed and added #includes for them. The build created the msword.tlh file etc. It also gave me over 100 errors, all due to missing items in the msword.tlh file. In the Add Class step, should I just be selecting the MSWord classes I need, and not just all of them? Or have I got this whole thing wrong? It worked OK back in the days of Office 97 and 2000. BTW, at this stage learning C# is not really an option. Thanks, Bryan.

        S 1 Reply Last reply
        0
        • B Bryan Anslow

          Hi Sujayg, I am trying to create a *.lib file to wrap some of the Word Automation Functions. So, tell me if I got this all wrong... I created a Win32 project, selecting MFC and Static Library. I used Add Class -> MFC Class From Typelib and selected File and used C:\\Program Files\\Microsoft Office\\Office15\\MSWORD.OLB As I did not know which classes I would need, I just selected them all. So it generated a lot of Class Header files. I selected a few Header files for the classes I needed and added #includes for them. The build created the msword.tlh file etc. It also gave me over 100 errors, all due to missing items in the msword.tlh file. In the Add Class step, should I just be selecting the MSWord classes I need, and not just all of them? Or have I got this whole thing wrong? It worked OK back in the days of Office 97 and 2000. BTW, at this stage learning C# is not really an option. Thanks, Bryan.

          S Offline
          S Offline
          SujayG
          wrote on last edited by
          #4

          The steps are correct and it worked fine in Office 2000. I had worked on Word automation in C++ / Office 2000 . Yes, I could reproduce the errors. Probably we need to make some changes, for working on C++ / Office. Have a look at [^] ; the steps in which the author makes a change to import. Also check the Word automation using C++ [^] - specially the Solution1.h/cpp and Solution1.h/cpp to view how imports are changed. Let us know if it helps. Sujay

          My Blog

          B 1 Reply Last reply
          0
          • S SujayG

            The steps are correct and it worked fine in Office 2000. I had worked on Word automation in C++ / Office 2000 . Yes, I could reproduce the errors. Probably we need to make some changes, for working on C++ / Office. Have a look at [^] ; the steps in which the author makes a change to import. Also check the Word automation using C++ [^] - specially the Solution1.h/cpp and Solution1.h/cpp to view how imports are changed. Let us know if it helps. Sujay

            My Blog

            B Offline
            B Offline
            Bryan Anslow
            wrote on last edited by
            #5

            Hi Sujay, Thanks for your invaluable information. Interestingly, this link http://blogs.msdn.com/b/vsod/archive/2013/06/05/office-automation-through-vc-using-mfc-class-from-typelib-results-into-large-number-of-compilation-errors.aspx has a somewhat different approach. So basically, we do no imports and just use the generated *.h files. I am in the middle of trying it, but will not be able to do more until next week. Bryan.

            S 1 Reply Last reply
            0
            • B Bryan Anslow

              Hi Sujay, Thanks for your invaluable information. Interestingly, this link http://blogs.msdn.com/b/vsod/archive/2013/06/05/office-automation-through-vc-using-mfc-class-from-typelib-results-into-large-number-of-compilation-errors.aspx has a somewhat different approach. So basically, we do no imports and just use the generated *.h files. I am in the middle of trying it, but will not be able to do more until next week. Bryan.

              S Offline
              S Offline
              SujayG
              wrote on last edited by
              #6

              Hello Bryan Thanks for sharing the link as well. I commented the import statement, and it worked fine. I have checked the functionality of the classes though. Thanks Sujay

              My Blog

              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