COM objects [MS Excel]

This is a discussion on COM objects [MS Excel] within the C# Programming forums, part of the General Programming Boards category; I have problem transferring a VS project to another computer. The problem is that it doesn't link correctly the Microsoft.Office.Interop.Excel ...

  1. #1
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853

    COM objects [MS Excel]

    I have problem transferring a VS project to another computer. The problem is that it doesn't link correctly the Microsoft.Office.Interop.Excel and Microsoft.Office.Core references.

    I use them on my system by adding a reference to the appropriate object, but in the target system (don't have personally access) they report that it doesn't work.

    My question would be, is there a way to have some kind of .dll instead and just give it with the project? I am not sure how the linking is done from these objects so I would like some ideas on how to make this fully portable.

  2. #2
    Registered User
    Join Date
    Feb 2009
    Posts
    329
    Quote Originally Posted by C_ntua View Post
    I have problem transferring a VS project to another computer. The problem is that it doesn't link correctly the Microsoft.Office.Interop.Excel and Microsoft.Office.Core references.

    I use them on my system by adding a reference to the appropriate object, but in the target system (don't have personally access) they report that it doesn't work.

    My question would be, is there a way to have some kind of .dll instead and just give it with the project? I am not sure how the linking is done from these objects so I would like some ideas on how to make this fully portable.
    Are they referencing the correct Excel and Core references? If my memory serves me right there are different versions of these, such as 12.0 and 5.0 (i think). Not sure if that would make the difference?

  3. #3
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    They are not able to find them at all. There are indeed a lot of versions but I would prefer if I could have the libraries themselves somehow in a dll.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,656
    Could be that your client has the wrong version of .NET installed - check that first, to be sure...



    ITSA
    Socket Library!

  5. #5
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,412
    Quote Originally Posted by C_ntua View Post
    My question would be, is there a way to have some kind of .dll instead and just give it with the project? I am not sure how the linking is done from these objects so I would like some ideas on how to make this fully portable.
    You'll need to include the Primary Interop Assemblies for the Office version you are building for in your setup project. The client also needs to have MS Office installed with a version equal or higher than the PIA referenced in your project.

    Office 2003 PIAs
    Office 2007 PIAs
    Office 2010 PIAs

    And this reading, for good measure: Deploying Interop Applications.

    EDIT: To clarify,

    1. Know which Office version the client has installed
    2. Download and install on your computer the corresponding PIA (most developers usually prefer to fallback to the Office 2003 PIA, if there multiple clients with multiple office versions.
    3. Change your project to reference the relevant assemblies (you should have multiple versions of Microsoft.Office.Core and Microsoft.Office.Interop.Excel. For an example of what kind of files are installed on your computer see the XP PIAs).
    4. Build your project normally.
    5. Build your setup project normally.
    6. Your done. The PIAs are distributed automatically in the step 5.

    Note: Do not feel tempted to use the XP PIAs, unless the client really has Office XP. I'm not quite sure, but I seem to remember there being problems attempting to use these on client machines with Office 2003 and above. Meaning, the rule that the client machine must have an offcie version equal or higher than the PIAs you redistribute, does not apply with the XP PIAs. These really only work with Office XP... or so I seem to think.
    Last edited by Mario F.; 12-18-2010 at 08:29 PM.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 07-15-2010, 07:53 PM
  2. Objects as attributes of other objects.
    By kbro3 in forum C++ Programming
    Replies: 10
    Last Post: 08-15-2009, 03:46 PM
  3. Replies: 60
    Last Post: 12-20-2005, 10:36 PM
  4. chain of objects within pop framework help needed
    By Davey in forum C++ Programming
    Replies: 0
    Last Post: 04-15-2004, 10:01 AM
  5. array of objects?
    By *~*~*~* in forum C++ Programming
    Replies: 4
    Last Post: 05-31-2003, 05:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21