Problem with Outlook Automation

N

Neil

I have some code I use to create a mail message in Outlook 2003 from Access
as follows:

Dim objOutlook As Outlook.Application
Set objOutlook = New Outlook.Application
etc....

The code works fine everywhere except on one computer. On that computer, the
user gets Error -2147024770: "Automation error. The specified module could
not be found." at the Set objOutlook line.

I did some searching online, and I found that most of the time when people
got that message, it was because a DLL wasn't registered. So I looked up the
reference (in Access 2003) to "Microsoft Outlook 11.0 Object Library," and
it referred to msoutl.olb. However, that OLB file can't be registered,
because it's not an OCX or DLL.

So, any thoughts about what needs to be done here?

Thanks!

Neil
 
G

Gerwin Berentschot

I had this problem once and just deleted the reference to this file in my
database. If that does not work just delete the reference to this file on the
PC's that give trouble and add a new reference to the object library that
does exist on those PC's (for example: Microsoft Outlook 10.0 Object Library).
 
B

BeWyched

Hi

This problem has been reported several times in this forum and, as yet,
there hasn't been a satisfactory explanation/resolution.

A work around is to use the GetObject funtion which works so long as Outlook
is open.

Use:

Set objOutlook = GetObject(, "Outlook.Application")

Good luck.

BW
 
N

Neil

Good thought, but I'm not sure that's it. Went into Excel and copied my
routine there, creating a brand new reference to the Microsoft Outlook 11.0
Object Library in the Excel module and ran the code. Same problem. Did the
same on another machine, and it worked fine.

So, somewhere, I think, a DLL isn't registered. Just don't know which one it
is.

Thanks,

Neil
 
N

Neil

It's been reported that it only happens on certain machines? As noted, I'm
running this code on at least 30-40 machines, all without problem. This is
the only machine that's having the problem.

So, these people who are having the problem, is it the same with them, where
it works on some machines but not others?

Thanks,

Neil
 
B

BeWyched

Hi Neil

I have this problem and it is machine specific. I've compared everything I
can think of but still can't ascertain why it works on some PC's and not
others.

I'm not sure about the other postings - I found them when I was trying to
resolve my problem but don't seeem to be able to find them again!

I'm still trying to sort my problem and will let you know if I find anything
positive.

BW
 
G

Gina Whipp

You are not alone, I too have this problem and I have spent hours on the
clients site trying to figure it out to no avail. I am keeping my eyes
pinned to this posting hoping someone can give some insight.
 
R

Rick Brandt

Gina Whipp said:
You are not alone, I too have this problem and I have spent hours on the
clients site trying to figure it out to no avail. I am keeping my eyes pinned
to this posting hoping someone can give some insight.

My advice is that for an application that is to be deployed on multiple machines
ZERO references should be added beyond the default ones. All other external
library calls should be done with late binding which does not require a
reference be added to the project.

Using late binding you eliminate code failures that are specifically caused by a
missing reference and you can just focus on what doesn't work. The only time I
have seen a late binding call to Outlook to not work I fixed it by doing a
repair of Office on that PC.
 
G

Gina Whipp

Rick,

I did the late binding first, still did not work but doing a repair of
Office, now I didn't try that! I guess I'll be going to the Client's site.
 
R

Rick Brandt

BeWyched said:
Thanks Rick.

I've tried using late binding and repairing Office to no avail. Previous
postings from others also confirms that late binding does not resolve the
problem.

I did not state that late binding would solve the problem. Only that when using
early binding you can experience errors that have nothing to do with the actual
problem which can make finding and correcting the actual problem much more
difficult.
 
N

Neil

Did you try uninstalling and reinstalling Outlook? I'm about to do that, but
if you tried it and it didn't change anything, then I won't bother.

Thanks,

Neil
 
N

Neil

Well, I tried it and it resolved the problem here, too. So, thanks!!
Amazing, though, about this: why wasn't this known/used before?...
 
N

Neil

Just FYI, the person whose machine had the problem uninstalled and
reinstalled office, and now his machine works with the original code
(without the "LocalHost" parameter). So that's interesting. I left the
parameter in, anyway, since it doesn't hurt anything.

Neil
 
B

BeWyched

Thanks for that.

I did try reinstalling Office on one PC without success. I did find a
reference to problems with Automation in the MS Knowledge Base. There a a
couple of articles - one is:
http://support.microsoft.com/kb/828550/en-us
It doesn't mention the Outlook problem specifically but talks more generally
about automation problems. To resolve, it suggests (amongst others) an Office
reinstall as a possible solution, but also mentions the 4 automation files
in the Windows folder that must have the same build number and creation date.
On my PC one of the files was different. I downloaded and ran the patch but
it doesn't install the correct versions as it is supposed to - I think that
this may be the basis of the problem.
It does mention (I think in a connected article) that the files are
associated with MS VB 6 which I do have on my PC - it would be interesting to
know if you also have VB installed as a seperate application as this could be
at the root of the problem.

As you say, its ok to leave the 'localhost' reference as the alternative to
reinstall Office is clearly impractical on remote PC's - not very encouraging
for external users to have to reinstall Office to makes ones softward work!

Regards.

BW
 
N

Neil

I do have VB 6 installed on my machine -- but my machine didn't have the
problem. The person's whose machine had the problem didn't have VB 6
installed.

Neil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top