Solved

Office>interop cannot be found

Posted on 2006-06-22
12
360 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

14 Experts available now in Live!

Get 1:1 Help Now