Consulting

Results 1 to 16 of 16

Thread: Error: ClassFactory cannot supply requested class

  1. #1

    Error: ClassFactory cannot supply requested class

    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

  2. #2
    Site Admin
    The Princess
    VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    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, 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.
    ~Anne Troy

  3. #3
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    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.

    [VBA]Dim WordObj As New Word Application[/VBA]

  4. #4
    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

  5. #5
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    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?

  6. #6
    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

  7. #7
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    /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
    ~Anne Troy

  8. #8
    VBAX Mentor
    Joined
    Sep 2004
    Location
    Nashua, NH, USA
    Posts
    489
    Location
    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.

    Quote Originally Posted by Howard Kaikow
    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.

    Quote Originally Posted by Howard Kaikow
    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.

  9. #9
    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

  10. #10
    VBAX Mentor
    Joined
    Sep 2004
    Location
    Nashua, NH, USA
    Posts
    489
    Location
    Quote Originally Posted by Michael 514
    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.

  11. #11
    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

  12. #12
    VBAX Mentor
    Joined
    Sep 2004
    Location
    Nashua, NH, USA
    Posts
    489
    Location
    Quote Originally Posted by Michael 514
    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?

  13. #13
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    UA? No. That's for people who can't stop uninstalling.
    ~Anne Troy

  14. #14
    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?

  15. #15
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    Aha. Yes. CA is just right for you!!
    ~Anne Troy

  16. #16
    VBAX Mentor
    Joined
    Sep 2004
    Location
    Nashua, NH, USA
    Posts
    489
    Location
    Quote Originally Posted by Dreamboat
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •