PDA

View Full Version : Error: ClassFactory cannot supply requested class



Michael 514
02-27-2005, 07:55 PM
Hello everyone!

This is my first post here! I guess I am what people call an Office 2003 power user, but I cannot code to save my life! (Have two degrees in Management Info Systems, but I rely on people like you to help me!)

I must have searched the web for three hours looking for an answer. No dice.

So, here's the situation.

I have a cool macro in Excel that accesses a bunch of Word documents in a specified directory, and pastes all the bookmarks of each document across a row of cells. It's really neat!

Anyways, it works on one of my PCs, but on my main one, it doesn't.

I get the following error:

Run-time error '-2147221231 (80040111)':
Automation error
ClassFactory cannot supply requested class

The error happens as soon as it tries to access Word, in this line:

Set WordObj = CreateObject("Word.Application")

I have seen a similar error on a colleague's PC when one of his Access apps tries to access Outlook.

A search throughout the 'net has shown me that I'm not the first person to experience this in various Word apps.

My intuition tells me that if I uninstalled Office 2003 and reinstalled it, I'd be fine.

But with all my service packs and what not, I realllly hope there is another way to solve it.

To test this macro, I have to use Remote Desktop Sharing and run it on my other machine. Not the end of the world, but very annoying!

If anyone can offer some insight or ideas, that would be amazing!!

Thanks!

Mike

Anne Troy
02-27-2005, 08:05 PM
While I've never heard of that error, I want to let you know about other steps to take to "fix" Word without complete uninstall/reinstall. You'll find all the troubleshooting steps at www.theofficeexperts.com/word (http://www.theofficeexperts.com/word), written by yours truly. :)

Perhaps it's just your normal.dot, perhaps Word just needs to be re-registered with Windows. If those don't work, then likely reinstalling won't either. It's very rare that it would.

I've also reworded the title to your question. Hopefully, we'll get a solution. Then, someday, when somebody searches like you did, they'll actually find the error in our archives, and the title will be meaningful to them. :)

Jacob Hilderbrand
02-27-2005, 08:13 PM
Try to use Early Binding. Set a reference to the Microsoft Word Object Library. From the VBE Tools | References.

Then instead of CreateObject try this.

Dim WordObj As New Word Application

Michael 514
02-27-2005, 08:21 PM
Hey there!

Sorry if I sound like a moron... but this is what I did.

I remmed out
'Set WordObj = CreateObject("Word.Application")

and replaced it with:

Dim WordObj As New Word.Application


The good news is that the macro didn't crash... it proceeded to do what's required (Ask me what row to start pasting and what column and then it opened up a Open File dialog box)

At this point... I was about to jump for joy...

But then...

Nothing happened. No bookmarks were pasted.

I did set a reference to the object library from the beginning.

In terms of Early Binding, I haven't a clue what that means(!)

Although, you may be on to something, because in some other thread somewhere, someone else talked about Early Bindings...

Is there anything else I'd have to do besides:

'Set WordObj = CreateObject("Word.Application")
Dim WordObj As New Word.Application

..or must I make some other changes to the code??

Let's hope we can solve this!! I'll be very very happy!

Thank you!

Mike

Jacob Hilderbrand
02-27-2005, 08:50 PM
Early Binding means that you set the reference manually. Late binding uses CreateObject to make the object at runtime. It should work with what you have done. Can you post your file as an attachment?

Michael 514
02-27-2005, 08:54 PM
Hi again!

The file is attached! (I put it back to the way it was before)

So strange... works great on one PC, crashes out on my main one...!

Thanks for looking into this!

Mike

Anne Troy
02-27-2005, 10:24 PM
/off topic

Mike, you might be interested in IFs:
http://www.addbalance.com/usersguide/fields.htm

About 2/3rds of the way down the page, look for this title:
Calculated Fields - Conditional Fields

Howard Kaikow
03-06-2005, 06:48 AM
The class factory error is an all too common error.

You will find lots of references in the MSFT KB and in the MSFT newsgroups.

I've encountered the critter, but, at this early hour, I do not recall how I fixed the problem. If I think of the solution, I'll post back.

I suggest searching the MSFT KB.


The class factory error is an all too common error.

You will find lots of references in the MSFT KB and in the MSFT newsgroups.

I've encountered the critter, but, at this early hour, I do not recall how I fixed the problem. If I think of the solution, I'll post back.

I suggest searching the MSFT KB.

My recollection is that I, and others, found the only solution was to uninstall, then re-install Office.


The class factory error is an all too common error.

You will find lots of references in the MSFT KB and in the MSFT newsgroups.

I've encountered the critter, but, at this early hour, I do not recall how I fixed the problem. If I think of the solution, I'll post back.

I suggest searching the MSFT KB.



My recollection is that I, and others, found the only solution was to uninstall, then re-install Office.

Went back and searched a bit.

Most postings I saw confirmed that th efix was to uninstall, then re-install Office.

In my case, as I recall, the problem occurred after I installed NAV 2004.

I believe that I did the following experiment, but I'm not sure.

1. Uninstall, then re-install Office. Problem goes away.
2. Re-install NAV 2004, problem re-appears.
3. Uninstall, then re-install Office. Problem goes away.

Alas, periodically, 3rd party apps such as AV software do seem to break OLE in Office.

Michael 514
03-06-2005, 10:22 AM
Very interesting stuff...
I wouldn't be surprised if NAV was the culprit (or part of it, anyway..)
It always does bizarre things with my machine.

I think that reinstaling Office is not an option.

MY PC is just so darn customized -- from my folder locations to the Places bar, from my button bars to my rules, from my autocorrects to my signature files...

(I also have no less than 20 E-mail accounts set up, too... with all sorts of passwords everywhere..)

Let's face it.. no matter how much Microsoft's "Save my Settings" wizard is an improvement over yesteryear, once you start uninstalling Office, it's just never the same...!

Although, I am goign to try to uninstall Norton. That could be interesting!

Thanks!
Mike

Howard Kaikow
03-06-2005, 03:41 PM
Very interesting stuff...
I wouldn't be surprised if NAV was the culprit (or part of it, anyway..)
It always does bizarre things with my machine.

I think that reinstaling Office is not an option.

MY PC is just so darn customized -- from my folder locations to the Places bar, from my button bars to my rules, from my autocorrects to my signature files...

(I also have no less than 20 E-mail accounts set up, too... with all sorts of passwords everywhere..)

Let's face it.. no matter how much Microsoft's "Save my Settings" wizard is an improvement over yesteryear, once you start uninstalling Office, it's just never the same...!

Although, I am goign to try to uninstall Norton. That could be interesting!

Thanks!
Mike

Sometimes a man's gotta do what a man's gotta do.

The class factory error is a show stopper and has to be overcome, or it will repeatedly byte you in the arse at unpleasant times.

A re-install should not affect current settings.
Perhaps, you can get by with just a re-install without doing the uninstall.

As far as I know a repair is not sufficicient.

Michael 514
03-07-2005, 09:23 AM
Nnnnnnnnnnnnno!

I will uninstall anything... but not Office 2003!!

One of these days, my computer is due for a format c:/. I'll try to wait until then.

I did set up Office 2003 on another computer behind me. I can practise with all my macros in there.

Thanks for the help!



MG

Howard Kaikow
03-07-2005, 10:14 AM
Nnnnnnnnnnnnno!

I will uninstall anything... but not Office 2003!!

One of these days, my computer is due for a format c:/. I'll try to wait until then.

I did set up Office 2003 on another computer behind me. I can practise with all my macros in there.

Thanks for the help!



MG

You can try Repair.
If that doesn't do the deed, then you can try re-install.
If that doesn't do the deed, then you gotta live with it, or overcome the fear of uninstalll. Hmm, I wonder if there's a support group for such fears? Perhaps, Uninstallers Anonymous?

Anne Troy
03-07-2005, 10:21 AM
UA? No. That's for people who can't stop uninstalling.

Michael 514
03-07-2005, 10:40 AM
I tried the /R repair.
No dice. :(

I should join Customization Anonymous.

I have more keyboard shortcuts and so forth than you could ever dream of!

Heck... look at my Task Bar...

It's a little crazy, no?
http://www.premierservice.ca/files/taskbar.jpg

Anne Troy
03-07-2005, 10:45 AM
Aha. Yes. CA is just right for you!!

Howard Kaikow
03-07-2005, 06:34 PM
Aha. Yes. CA is just right for you!!

Aren't there already too many people in CA?
A few more and it might sink into the Pacific Ocean.