C# .NET - C# interfacing with excel

Asked By Lary
08-May-11 05:35 PM
I am using C# in microsoft visual studuo 2008. have been succesfully interfacing with excel 2003 via the use of

using Excel = Microsoft.Office.Interop.Excel;

and of course the common commands.

now my work suddently decided that all computers need to be updated to office 2010 package. and i now get a error message:
The type or namespace name 'Office' does not exist in namespace 'Microsoft' (are you missing a namespace reference?)

when i start typing in "Microsoft." in the code i get options of what can come next, "Office" is not included there. what do i need to change in my code to make everything work again with office 2010? 

Thanks for your assistance
  Peter Bromberg replied to Lary
08-May-11 06:52 PM
If you open up your Add Reference dialog you should see a number of Interop.Exel assemblies that you can set a reference to.
  James H replied to Lary
08-May-11 11:23 PM
Hi please follow the Steps given below
Add a reference to the Microsoft Excel Object Library. To do this, follow these steps:
  1. On the Project menu, click Add Reference.
  2. On the COM tab, locate Microsoft Excel Object Library, and click Select.

    Note Microsoft Office 2003 includes Primary Interop Assemblies (PIAs). Microsoft Office XP does not include PIAs, but they can be downloaded. For more information about Office XP PIAs, click the following article number to view the article in the Microsoft Knowledge Base:
    http://support.microsoft.com/kb/328912  (http://support.microsoft.com/kb/328912/%20) Microsoft Office XP primary interop assemblies (PIAs) are available for download
  3. Click OK in the Add References dialog box to accept your selections. If you are prompted to generate wrappers for the libraries that you selected, click Yes.
Please refer this link for any information regarding the http://msdn.microsoft.com/en-us/library/ms173186%28v=vs.80%29.aspx#Y342 .dll.
Hope this will help you:-)
  Vickey F replied to Lary
09-May-11 12:05 AM

For your problem, first add these reference in your project-

Microsoft.Office.Interop.Excel.


for this right click on project and clieck on add reference-

add AddReference->.NET->Microsoft.Office.Interop.Excel.

for more deila follow this-
http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/201ebd48-c24c-418b-afec-b799b6222f30/


 

 

  Riley K replied to Lary
09-May-11 12:50 AM

To add references to the Excel 2010 primary interop assembly

  1. On the Visual Studio Project menu, click Add Reference.

  2. In the Add Reference dialog box, select version 14.0.0.0 of the Microsoft.Office.Interop.Excel component, and then click OK to add the reference.



    Adding the reference
That's it
  Lary replied to Riley K
10-May-11 09:12 AM
Thank you everyone for your prompt and useful reply. :)
Create New Account
help
microsoft office xp Prof w / front page Windows 7 Trying to install Wind XP SP3 but halfway thru installation get message to insert Microsoft Office XP Pro. w / Front page disk - I do not have this - how can I fix this- Windows Update Discussions Office XP (1) Office 2003 (1) XP (1) Windows (1) EB966BCDFB5E (1) DA5FBCB3F0E2 (1) Southworks (1
office 2003 upgrade Office I have Microsoft Office XP Professional for 2002. I am about to start online courses that require Microsoft Office XP Prof 2003. I don't know why I can't just use the 2002. They
office xp Office How do I install Microsoft Office XP Professional on a laptop with windows Vista? Office Miscellaneous Discussions Office XP (1) Vista (1) OfficeXP (1) Powerpoint (1) Leslie (1) Muire (1) Do you have
Microsoft Office XP Version 10.0.6819 reinstall Office I need to reinstall Microsoft Office XP Version 10.0.6819 but I have no disk. it came with when I bought it new. However I do have the key Office Miscellaneous Discussions Office XP (1) Shannon (1) Prohibits (1) Garfield (1) Odie (1) No CD
come posso recuperare il microsoft office xp professional rimosso Office ?? stato rimosso per abaglio il microsoft office xp professional dal mio computer per sbaglio. Office Discussions Usando (1) Installandolo (1) Recuperare (1) Abaglio (1) Rimosso (1) Scritto (1) Nuovo (1