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. COM
  4. Creating Automation Project using Visual Studio 2010 and Excel 2010

Creating Automation Project using Visual Studio 2010 and Excel 2010

Scheduled Pinned Locked Moved COM
comcsharpvisual-studiotestingdebugging
3 Posts 2 Posters 9 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi, I followed Microsoft Knoweldge base Article 178749 http://support.microsoft.com/kb/178749[^] To create and an Automation When I got the Class wizard I selected Create Class from typelib I the selcted the excel.exe The Wizard create a number of Class I slected to include all of them in my project After getting a Clean build I decided to add some ole code create excel So I included "CAppliction.h" I coded CApplication app; app.CreateDispatch("EXCEL APPLICATION"); however I got a whole slew of build errors example c:\users\4rypb\documents\visual studio 2010\projects\autoproject\autoproject\debug\excel.tlh(1595): error C2371: 'FontPtr' : redefinition; different basic types 1> c:\program files\microsoft visual studio 10.0\vc\include\comdef.h(314) : see declaration of 'FontPtr' or c:\users\4rypb\documents\visual studio 2010\projects\autoproject\autoproject\capplication.h(3): warning C4278: 'RGB': identifier in type library 'C:\\Program Files\\Microsoft Office\\Office14\\EXCEL.EXE' is already a macro; use the 'rename' qualifier Am I mssing some include ? The doc says include excel8.h but I dont see that included generated Thanks

    G 1 Reply Last reply
    0
    • F ForNow

      Hi, I followed Microsoft Knoweldge base Article 178749 http://support.microsoft.com/kb/178749[^] To create and an Automation When I got the Class wizard I selected Create Class from typelib I the selcted the excel.exe The Wizard create a number of Class I slected to include all of them in my project After getting a Clean build I decided to add some ole code create excel So I included "CAppliction.h" I coded CApplication app; app.CreateDispatch("EXCEL APPLICATION"); however I got a whole slew of build errors example c:\users\4rypb\documents\visual studio 2010\projects\autoproject\autoproject\debug\excel.tlh(1595): error C2371: 'FontPtr' : redefinition; different basic types 1> c:\program files\microsoft visual studio 10.0\vc\include\comdef.h(314) : see declaration of 'FontPtr' or c:\users\4rypb\documents\visual studio 2010\projects\autoproject\autoproject\capplication.h(3): warning C4278: 'RGB': identifier in type library 'C:\\Program Files\\Microsoft Office\\Office14\\EXCEL.EXE' is already a macro; use the 'rename' qualifier Am I mssing some include ? The doc says include excel8.h but I dont see that included generated Thanks

      G Offline
      G Offline
      Garth J Lancaster
      wrote on last edited by
      #2

      there's going to be different headers eg excel8.h, for different versions of Excel - you've already said you're using Excel 2010, so, an alarm bell goes off in my head straight away on that score ... as to the rest, its been a long time since Ive needed to do this, but I found this article here in CP that may give you some more (and definately) better guidance .. Automating Excel 2007 and creating charts using C++ MFC application in Visual Studio 2008[^] (before you shoot me down in flames, please have a look at the article - it suggests it should be good for Excel 2010 as well, else I wouldnt have posted it)

      F 1 Reply Last reply
      0
      • G Garth J Lancaster

        there's going to be different headers eg excel8.h, for different versions of Excel - you've already said you're using Excel 2010, so, an alarm bell goes off in my head straight away on that score ... as to the rest, its been a long time since Ive needed to do this, but I found this article here in CP that may give you some more (and definately) better guidance .. Automating Excel 2007 and creating charts using C++ MFC application in Visual Studio 2008[^] (before you shoot me down in flames, please have a look at the article - it suggests it should be good for Excel 2010 as well, else I wouldnt have posted it)

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        commented out #import Tnanks

        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