Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Office>interop cannot be found

Posted on 2006-06-22
12
366 Views
Last Modified: 2008-02-01
I followed alone a sample I found on this site that will integarte outlook into my win form app. See link below.
(http://www.experts-exchange.com/Programming/Q_21654833.html?query=ole+vb.net&clearTAFilter=true)

However, I got next build error.
Namespace or type 'Interop' for the Imports 'Microsoft.Office.Interop' cannot be found.

I have set the ref to the outlook (as the answer has suggested) as well as to office11.o obj library COM.

What else could I miss?

Thanks!
0
Comment
Question by:ommer
  • 6
  • 4
  • 2
12 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16963729
When you type Imports, is Microsoft in the Intellisense dropdown?

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16963735
I have seen where it would work without the Imports line, but I don't understand the differences in the COM wrapper generated.

Bob
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 16963838
Hi ommer;

I tested the code that was posted in the other question and it does work.

When you entered

    Imports Microsoft.Office.Interop

Did Intellisense display all the nodes, Microsoft the Office and finally Interrop?

Fernando
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 16963872
Fernando,
I have problems taking code home from work (with the Imports lines), and I don't know the reason for it yet.  It may work for you, but that isn't always a good test.

Bob
0
 

Author Comment

by:ommer
ID: 16970324
The intellisence only gave me Microsoft.office but not interop. I have only .core after that.
I got that by going into add referece-->com, microsoft office 11.0 object library, typelib version 2.3, point to C;\progarm Files\Common Files\Microsoft Shared\Office11\MSO.DLL.

What is wrong here?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16970337
Try commenting the Imports line, and see if you get any compiler errors.

Bob
0
 

Author Comment

by:ommer
ID: 16971499
No compile error if I commented out the imports, however, the outlook did not come up. I got Cannot Start Microsoft Outlook. A program error occured. Quit Outlook and Windows and then start again.
The error is on line
 ol_App = CreateObject("Outlook.Application")

and it happened when I have my outlook 2003 open.

If I close my outlook, then run the program, nothing happened, no crash, and no outlook shows up.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 200 total points
ID: 16971612
Do you need to interface with multiple Outlook versions, or just 2003?

If so, then you should be using early-binding:

Dim ol_App As Outlook.Application

...

ol = New Outlook.Object

Bob
0
 

Author Comment

by:ommer
ID: 16971777
In my try block I have these two lines. They seem don't like to run together.
ol_Mail.Display()
CType(ol_Mail, Outlook._MailItem).Send()

If I close my regular outlook window, and run ol_Mail.Display() only, It DID open an Outlook mail window with the subject and other info from my program, but there was not Send button or menu.

If I close my regular outlook window, and run CType(ol_Mail, Outlook._MailItem).Send() only, nothing happened.

And finally, if I have my regular outlook open on the background, the CreateObject line errored out, as my previous post has said.

I guess I need to find a good resource on the subject and read it up on the weekend:)
0
 
LVL 63

Assisted Solution

by:Fernando Soto
Fernando Soto earned 150 total points
ID: 16972079
Hi ommer;

You stated that you added the following reference "I got that by going into add referece-->com, microsoft office 11.0 object library, typelib version 2.3" You needed to add the following reference:

Add Referece--> COM-> Microsoft Outlook 11.0 Object Library  TypeLib Version 9.3

This will load into your reference Microsoft.Office.Core and it will also load OutLook

This should fix your problem.

Fernando
0
 

Author Comment

by:ommer
ID: 16972548
I have had Outlook 11.0 Object Library  TypeLib Version 9.3.

Last run, I have removed the office 11.0 object library, and got the same result.

I have also found on msdn that I might need Office XP primary interop assemblies (PIAs) since my OS is xp pro.

That is why I said I need to check all these out during the weekend.

My original question is too narrow. I thought it was just a matter of setting ref right, then the sample will work. Now I want to approach the issue as how to integrate outlook all together. So I want to increase the points.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16980798
Ooh, don't do that.  You don't need the Office XP PIAs, you need the Office 2003 PIAs which get installed when you install Office.

Bob
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question