Solved

Office>interop cannot be found

Posted on 2006-06-22
12
361 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 62

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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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 62

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert to Hour/minute textbox and compare 3 53
Getting multiple values from a dataset ASP.NET(VB) 3 37
DataGridView Events ? 3 38
Close form "before" open 3 28
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

861 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now