Solved

Office>interop cannot be found

Posted on 2006-06-22
12
367 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending receiving text messages in vb.net 15 62
VB.Net - String Manipulation Scenario 2 29
Access/Visual Basic Question 3 41
ModalPopup  question 22 37
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

680 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