Automation to Word & Excel

C

Cheval

My automation has come to a halt.

I have upsized my Office 2000 application to Office 2003
and now I cannot automate to Word or Excel. Even the
creating the object fails. The error message is

-2147221231
Automation error
ClassFactory cannot supply requested class

The problem only occured when I installed Office 2003. It
had been working from when I installed Office 97, then
Office 2000 and then Office XP.

Can anyone help or is there a patch I need to install?

FYI:
OS: Win2K
Office versions installed: 97, 2K, XP & 2003
 
A

Alp Bekisoglu

I'm not sure if this IS the reason (and neither am I an expert here) but it
helps to check your references in the VBA window.
i.e. if your old (2000) was referencing to DAO and now that reference is not
there then some of your code will not work.

Hope it will help the least bit.

Alp
 
C

Cheval

1 Dim WdApp As Word.Application
2
3 Set WdApp = CreateObject("Word.Application")

3rd. On the set the variable to the object created. I've
tried telling it which version and different forms of the
object name, yet no success.
 
C

Cheval

Thanks, I also thought it might have been this, yet sorry
no. I've checked the references to make sure that they
were the correct version to the calling version of Access,
yet the same error every time. There's a funny thing
though. I can install Office 97 by itself /Microsoft
Offce/ and no problems, add Office 2000 to /Microsoft
Office 2000/ and no problems, add Office XP /Microsoft
Office XP/ and no problems, add Office 2003 /Microsoft
Office 2003/ and it errors. 2003 wouldn't be hard coded to
look at the "Microsoft Office" folder only would it?
 
T

TC

It seems you are using "early binding". That is, you have established a
reference to the Word object library using the Tools:References option.

Try temporarily Dim'ing WdApp 'As Object', then try again, with line 3
exactly as shown below.

- If the error disappears, maybe you have referenced the wrong version of
the Word object library. Whuich version of that library, have you
referenced?

- If you still get the error, I would say that there is something wrong with
your installation of Office. It shouldn't be anything to do with the
references, since you have not >used< the references if you dim WdApp 'As
Object'.

HTH,
TC
 
C

Cheval

Yes, it also gives the same error on late binding as well.

I have referenced the same version as the Access Version
11.

The problem is I have removed and re-installed Office 2003
and it still happens. Even the developer extensions as
well.

This one has got me stumped. I'm seriously considering re-
partioning the hard drive to have muli-boots into
different verisons of Office, yet I shouldn't have to.

Could this be similar issue to the problem I was having
with the Linked tables disappearing? All I needed to do in
that case was re-register a Office 2003 dll and all was
fine again.
 
T

TC

So, to recap, this code:

Dim WdApp As Object
Set WdApp = CreateObject("Word.Application")

gives:
-2147221231
Automation error
ClassFactory cannot supply requested class

Sorry, I'm pretty much out of ideas here. Clearly there is something wrong
with the ability to start Word via Automation. Are you sure that you can
start Word >manually<?

HTH,
TC
 
C

Cheval

Yes that is correct. It used to be both Word and Excel,
yet just testing it today and Excel works fine. I still
think it's a DLL gone haywire somewhere.

Even this fails with the same error:

Dim oApp As Object
Set oApp = CreateObject("Word.Application")

Yeah I can start every version of Word. I just noticed
something. I have only Access 97 installed in
the /Microsoft Office/ folder, could it be that it is
looking there for Word first and not finding it, fails to
look in the /Microsoft Office 2003/ folder?
 
T

TC

Yes that is correct. It used to be both Word and Excel,
yet just testing it today and Excel works fine. I still
think it's a DLL gone haywire somewhere.

So it is not an Office problem. It is just a Word problem?

Even this fails with the same error:
Dim oApp As Object
Set oApp = CreateObject("Word.Application")

Not sure I understand you here. That is precisely the same code, except for
the variable name. The variable name would not have any significance to the
problem you are having.

Yeah I can start every version of Word.

So you have more than one version? Try each of the following, in turn, & see
if one works:

"Word.Application.n"
with n = 7, then 8, then 9, then 10;
eg. "Word.Application.7".

I just noticed
something. I have only Access 97 installed in
the /Microsoft Office/ folder, could it be that it is
looking there for Word first and not finding it, fails to
look in the /Microsoft Office 2003/ folder?

Not likely. Windows uses the registry to determine the location of the files
it needs for Automation.

HTH,
TC
 

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