Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Imports Excel = Microsoft.Office.Interop.Excel doesn't work
Hi,
I am trying to learn VSTO programming. I have Windows Vista installed. When I type Imports Excel = Microsoft.Office.Interop.Excel, Intellisense does not recognize anything after Microsoft. A green squiggly appears under the statement. The tool tip says, "Namespace or type specified in the Imports 'Microsoft.Office.Interop.Excel' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases." I downloaded, unblocked, and installed the Office PIA's, but I still get the same result. Is this another dirty Vista trick, or have I missed something? Marty |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Imports Excel = Microsoft.Office.Interop.Excel doesn't work
It doesn't work using VBA (XL 2003 - Windows XP) either, I get "Variable not defined" and it highlights "Microsoft". -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "Uncle Martin" wrote in message Hi, I am trying to learn VSTO programming. I have Windows Vista installed. When I type Imports Excel = Microsoft.Office.Interop.Excel, Intellisense does not recognize anything after Microsoft. A green squiggly appears under the statement. The tool tip says, "Namespace or type specified in the Imports 'Microsoft.Office.Interop.Excel' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases." I downloaded, unblocked, and installed the Office PIA's, but I still get the same result. Is this another dirty Vista trick, or have I missed something? Marty |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Imports Excel = Microsoft.Office.Interop.Excel doesn't work
I am "replying" to my own post to supply an addendum:
After playing around a bit, I find that this line of code *does* work when you are using one of the office templates, e.g., the Excel Workbook Visual Studio template. However, I was trying to follow an example in the book, "Visual Studio Tools for Office Using Visual Basic 2005" by Eric Carter and Eric Lippert. The example involves creating an automation add-in using a Visual Basic Class Library template. For some reason, in that environment (on my system), the command is not recognized. Later in the code example, the following line appears: Dim r2 As Excel.Range = number2 As you may expect, the compiler balks at that, also. Is there some reason that you cannot access this namespace from a class library project? If that is the case, why did the authors include that line of code in their example? Is it just a typo, or has something changed because I am using Vista? Did I miss some other setting that must be included in order to access it? Thanks, Marty "Uncle Martin" wrote: Hi, I am trying to learn VSTO programming. I have Windows Vista installed. When I type Imports Excel = Microsoft.Office.Interop.Excel, Intellisense does not recognize anything after Microsoft. A green squiggly appears under the statement. The tool tip says, "Namespace or type specified in the Imports 'Microsoft.Office.Interop.Excel' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases." I downloaded, unblocked, and installed the Office PIA's, but I still get the same result. Is this another dirty Vista trick, or have I missed something? Marty |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Imports Excel = Microsoft.Office.Interop.Excel doesn't work
Well, I guess I should read more carefully!
The book says, "To use Listing 3.2, you must add a reference to the Excel 11.0 Object Library and also add the code Imports Excel = Microsoft.Office.Interop.Excel." I had missed the bit about adding a reference to the Excel 11.0 Object Library; I only saw "add the code...". I have added references in VBA, but this was my first time in VSTO, so I had to go hunting: Under the Project Menu, select Add Reference... Then click on the COM tab and scroll down. Well, at least I hope someone else will be able to benefit from my error! Thanks, Marty "Uncle Martin" wrote: I am "replying" to my own post to supply an addendum: After playing around a bit, I find that this line of code *does* work when you are using one of the office templates, e.g., the Excel Workbook Visual Studio template. However, I was trying to follow an example in the book, "Visual Studio Tools for Office Using Visual Basic 2005" by Eric Carter and Eric Lippert. The example involves creating an automation add-in using a Visual Basic Class Library template. For some reason, in that environment (on my system), the command is not recognized. Later in the code example, the following line appears: Dim r2 As Excel.Range = number2 As you may expect, the compiler balks at that, also. Is there some reason that you cannot access this namespace from a class library project? If that is the case, why did the authors include that line of code in their example? Is it just a typo, or has something changed because I am using Vista? Did I miss some other setting that must be included in order to access it? Thanks, Marty "Uncle Martin" wrote: Hi, I am trying to learn VSTO programming. I have Windows Vista installed. When I type Imports Excel = Microsoft.Office.Interop.Excel, Intellisense does not recognize anything after Microsoft. A green squiggly appears under the statement. The tool tip says, "Namespace or type specified in the Imports 'Microsoft.Office.Interop.Excel' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases." I downloaded, unblocked, and installed the Office PIA's, but I still get the same result. Is this another dirty Vista trick, or have I missed something? Marty |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Microsoft.Office.Interop.Excel when exporting from another program | Excel Discussion (Misc queries) | |||
Microsoft.Office.Interop.Excel Texttocolumns C# | Excel Programming | |||
Where can I find Microsoft.Office.Interop.Excel.dll? | Excel Programming | |||
COMException With Microsoft.Office.Interop.Excel | Excel Programming | |||
Microsoft.Office.Interop.Excel SaveAs error when clicking no or ca | Excel Programming |