Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fast Help Needed --- Miscrosoft Outlook 11.0 Object Library

Status
Not open for further replies.

sd110404

Programmer
Nov 3, 2004
63
0
0
US
Hi,

Let me quickly explain the problem.

I am using outlook to send mail (with attachment) on clicking the button. So in Tools Reference I have checked "Miscrosoft Outlook 11.0 Object Library".

And when I run the application in my system its working fine.
This application is been placed in a common folder in the server and everyone in the office will click on the application to use it.

So few of the ppl have "Miscrosoft Outlook 10.0 Object Library" in there systems. And hence its not bringing up the screens.

How can i overcome this? What can be the solution? Is there a way where by code wise I can check what version and point to the corresponding object library?

Please any solution.
Thanks a lot in advance.
 
My preferred way of doing automation, is using late binding, which makes it independent of version. You should find something here thru search.

So I remove the reference, and use syntax like this:

[tt]dim oOutl as object ' in stead of outlook.application
dim oMail as object ' in stead of outlook.mailitem

' then creaete an instance of outlook thru

set oOutl = createobject("outlook.application")
set oMail=oOutl.createitem(0)
'...[/tt]

- typed not tested...

Roy-Vidar
 
Thanks a lot for the quick reply. But i couldnt post my reply in time.

Actually Roy, pls see the below lines, which I had tried before :

Dim ol As Object
Set ol = CreateObject("Outlook.Application")
Dim mailOL As Object
Set mailOL = CreateObject("Outlook.MailItem")
mailOL = ol.CreateItem(olMailItem)

And it gave me an error saying "ActiveX component doesnt find object" (something like that).

Then i tried using ur syntax,

Dim ol As Object
Set ol = CreateObject("Outlook.Application")
Dim mailOL As Object
Set mailOL = ol.CreateItem(0)

It says "Object not found"

Do you see any problem there? What else can be done? I tried copying the reference to the target system too.. but no luck, do i have to register those files? Pls help.
 
The reference relates to the version the user have, so you cannot copy/use a reference that isn't installed on the computer where the app is used (2000 -> 9.0, 2002 -> 10.0, 2003 - 11.0)

Is Outlook installed on the computers?

Roy-Vidar
 
Yes Roy, the Outlook is installed on the computer. And Its 2002->10.0

And it says Missing: Miscrosoft Outlook 11.0 Object Library
so if i am not wrong , then its 2003--> 11.0.

So what i did was copied the corresponding file frm the same system under folder OFFFICE10 and copied to OFFICE11.

I know thats not the right way. Bcos each time when they upgrade the pbm will recurr right?

So i was thinking the best way through code. so that it will detect automatically. Is that possible?
 
When using late binding, as stated in my first reply, remove the reference (uncheck the Microsoft Outlook N.M Object Library).

If you are determined to try to add/remove/resolve references programaticcaly, you should be able to find info on that here too thru a search, or if someone pops in here with some info, but as stated, I prefer late binding, which works on my, and my customers setups (and again, with the references to those libraries removed).

Roy-Vidar
 
I am so happy to hear that late binding is working at ur system.

You tried the same code that you had pasted earlier?

I had tried the below code after removing the reference.

Dim ol As Object
Set ol = CreateObject("Outlook.Application")
Dim mailOL As Object
Set mailOL = ol.CreateItem(0)

Can you paste the code that you tried. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top