Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Office>interop cannot be found

Posted on 2006-06-22
12
Medium Priority
?
371 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
[X]
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
  • 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 64

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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 800 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 64

Assisted Solution

by:Fernando Soto
Fernando Soto earned 600 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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 …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

670 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