In a Program in the afternoon, I want to import an EXCEL table, but it displays
1. There is no type or namespace name Office in the namespace Microsoft (is the Assembly reference missing ?)
2. There is no type or namespace name Interop in the namespace Microsoft (is it missing Assembly reference ?)
It is very troublesome. After searching by multiple parties, we can finally solve the problem and study after leaving notes.
The first thing to do is to add references (download online)
Microsoft. Office. Interop. Excel. dll
Microsoft. Office. Interop. SmartTag. dll
Microsoft. Office. Interop. Word. dll
Add as needed.
It is worth noting that:
In VS2010, when COM components are referenced, the "…", Use the error message of the applicable interface instead. Check the information and find the solution. The record is as follows:
Right-click the dll introduced in the project, select properties, and set "embedded interoperability type" to False.
In this way, there should be no problem. If there is no problem, you don't have to look at the following.
If the problem persists:
1. There is no type or namespace name "Office" in the namespace "Microsoft" (is the Assembly reference missing ?)
Method 1 (if you have installed. net FrameWork1.1 and Office2003)
1. Insert the office2003 disk and select "delete add program" (which seems to be called this) --> advanced -->
Microsoft office ---> Microsoft office Excel --> Run all programs (Word, PPT, and so on) from the local machine)
2 Microsoft office --> office tools --> MicroSoft Forms 2.0.net programmable support --> Run all programs from the Local Machine
3 Microsoft office --> office tools --> Smart Tag plug-in --> Run all programs from the Local Machine
4. After the update is complete, open visual 2008 to add reference, "C: // Program Files // common Files //
Microsoft Shared // Office10 // MSO. DLL ", add" Microsoft. Office. Core ".
5 OK
Method 2 reinstall Office2003 directly and follow the steps in method 1.
2. The namespace "Microsoft" does not contain a type or the namespace name "Interop" (is the Assembly reference missing ?)
After completing the first step,
Find "Reference", right-click --> Add reference -----> microSoft. Office. Interop. Excel 11 (or 12) (. Net) to import.
Let's see, is it OK?
From IT fat Column