CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2009
    Posts
    11

    Smile unable to load excel

    Hello all,

    I am working on a project and want to load excel libraries into C++ so that I can read/write data into cells.
    Code:
    #include <iostream>
    #include <cmath>
    
    // Office XP Objects (2003)
    #import "C:\Program Files\Common Files\Microsoft Shared\OFFICE12\mso.dll"\
    	rename("DocumentProperties", "DocumentPropertiesXL")\
    	rename("RGB", "RBGXL")
    
    //Microsoft VBA objects
    #import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
    
    //Excel Application objects
    #import "C:\Program Files\Microsoft Office\Office\excel.exe" \
    	rename("DialogBox", "DialogBoxXL")\
    	rename("RGB", "RBGXL")\
    	rename("DocumentProperties", "DocumentPropertiesXL")\
    	rename("ReplaceText", "ReplaceTextXL")\
    	rename("CopyFile", "CopyFileXL")\
    	exclude("IFont", "IPicture") no_dual_interfaces
    
    using namespace std;
    When I wrote the above code, I am getting an error

    Code:
    fatal error C1083: Cannot open type library file: 'c:\program files\microsoft office\office\excel.exe': Error loading type library/DLL.
    Can someone please tell me what I am missing here inorder to run the code.

    Thanks In Advance.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: unable to load excel

    Victor Nijegorodov

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured