Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft.Office.Interop.Excel when exporting from another program Colin Excel Discussion (Misc queries) 0 January 2nd 09 06:08 AM
Microsoft.Office.Interop.Excel Texttocolumns C# Cheryl[_5_] Excel Programming 1 April 6th 07 08:40 PM
Where can I find Microsoft.Office.Interop.Excel.dll? Fred Abrahamian Excel Programming 1 December 17th 06 10:52 PM
COMException With Microsoft.Office.Interop.Excel frankvfox Excel Programming 4 September 27th 06 04:36 PM
Microsoft.Office.Interop.Excel SaveAs error when clicking no or ca NeedsExcelAssistance Excel Programming 0 July 14th 06 02:50 PM


All times are GMT +1. The time now is 05:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"