Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / November 2004



Tip: Looking for answers? Try searching our database.

Err 2147221231 Classfactory cannot supply requested class

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Yendor - 19 Aug 2004 23:24 GMT
Can anyone help resolve the cause of the error:

Err 2147221231 Classfactory cannot supply requested class

This error is triggered by one of the following 2 statements when my VB6
program loads Word :

Set App = New Word.Application

OrigWordDocsPath = App.Options.DefaultFilePath(wdDocumentsPath)

I only get this error with one user of my software (hundreds of other
installations run the same s/w, no problem).

This particular user has Office 2003 on Win XP Home, I am sure I have other
users with the same configuration and who run OK, is there something unusual
about this user's Windows, if so what?

MS Knowledgebase lists this error under things like SQL server, data
warehousing and MAPI - non of which have any relevance to my user's
environment. The Knowledgebase refers to version incompatibilities with
MSOLAP80.DLL so I have tried putting our version of this .dll (which
obviously works on our development system) on the users system but this does
not fix the problem.

I'm at the end of my tether with this one and would appreciate any help at
all.

Thanks
Jens Neuhalfen - 20 Aug 2004 17:17 GMT
> Can anyone help resolve the cause of the error:
>
> Err 2147221231 Classfactory cannot supply requested class

[snip]

That happens quite frequently when dlls are replaced by incompatible
versions. Let me do a quick walkthrough:

(working)

1) call CoCreateObject({word.application clsid}) (which is "New
Word.Application")

2) COM: Calls CoGetClassObject
3) CoGetClassObject
   looks up HKCR\CLSID\{word.application clsid}\LocalServer32
     Which points to C:\ProgramFiles\MS\Office\Winword.exe

4) CoGetClassObject: starts Winword.exe with "/EMBEDDING"

5) WinWord: calls CoRegisterClassObject(...) to anounce
       it classfactory

6) CoCreateObject: gets hold of the classfactory for
   {word.application clsid}

7) Then it calls
   IClassFactory::CreateInstance({word.application clsid})

8) Now the ClassFactory in  WINWORD.EXE returns a new
   Word.Application object

(not working)
Now imagine the user had installed a new version of word and
uninstalled it (but left the registry keys). The he installed an
older version of word.

Now the registry keys point to a valid exe and the steps 1-5 will
work. In step 6 the old word version doesn't know anything about the
CLSID of the next version and so it won't be registered and the call
will fail.

(hopefully I didn't mess things up, but the general concept should
be clear. Please correct me if I made an error)

Jens

(see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/comext_
4otw.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/cmf_a2c
_6yb8.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/cmf_a2c
_6kz8.asp

)
Yendor - 23 Aug 2004 19:46 GMT
Thanks Jens,

We uninstalled Microsoft Office then re-installed it and the problem is now
fixed.

The worrying thing though is that this is a relatively (couple of months
old) computer from Dell (Dell support did not want to know about this
problem) with Office pre-installed and which has not been amended or updated
in any way - does this mean Dell are shipping out computers with corrupted
Office!?!

Thanks again,

Yendor

> > Can anyone help resolve the cause of the error:
> >
[quoted text clipped - 45 lines]
>
> (see

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/comext_
4otw.asp


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/cmf_a2c
_6yb8.asp


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/cmf_a2c
_6kz8.asp

> )
Jens Neuhalfen - 24 Aug 2004 14:18 GMT
> Thanks Jens,
>
[quoted text clipped - 6 lines]
> in any way - does this mean Dell are shipping out computers with corrupted
> Office!?!

I won't bet on it, but it seems that their install-images went
through some changes. :-/

Jens

> Thanks again,
>
> Yendor
Howard Kaikow - 31 Aug 2004 23:41 GMT
I got the same error as follows:
Using either of the subs below, I am unable to create a Word object and get
the same error message in both cases.

I know that I ran analogous code successfully on 22 July 2004, with NAV
2003.

As far as I know, the only software installed since then was NAV 2004 on 24
August 2004.

Does anybody with Office 2003 and NAV 2004 see the same error?
Problem does not occur, on another systetm, with Office 2002 and NAV 2003.

Option Explicit

Private Sub CreateWordObjectUsingNew()
   Dim appWord As Word.Application

   On Error Resume Next
   Set appWord = New Word.Application
   If Err.Number <> 0 Then
       Debug.Print Err.Number, Err.Description
       Exit Sub
'-2147221231   Automation error
'ClassFactory cannot supply requested class
   End If
   appWord.Quit
   Set appWord = Nothing
End Sub

Private Sub CreateWordObjectUsingCreateObject()
   Dim appWord As Word.Application

   On Error Resume Next
   Set appWord = CreateObject("Word.Application")
   If Err.Number <> 0 Then
       Debug.Print Err.Number, Err.Description
       Exit Sub
'-2147221231   Automation error
'ClassFactory cannot supply requested class
   End If
   appWord.Quit
   Set appWord = Nothing
End Sub
Signature

http://www.standards.com/; See Howard Kaikow's web site.

> Can anyone help resolve the cause of the error:
>
[quoted text clipped - 25 lines]
>
> Thanks
Howard Kaikow - 06 Sep 2004 17:20 GMT
I have more info.

I uninstalled NAV 2004.
Then instead of the ClassFactory error, I got:

-2147024770 Automation error
The specified module could not be found

I reinstalled NAV.

So, I then ran a detect and repair of Office.
Still got error.
Ran a Reinstall of Office.
Still got error.
Uninstalled, then re-installed Office.
No more error.

So, something clobbered something in Office between 22 July 2004 and 31 Aug
2004.
Only software installed in that time frame was NAV 2004.
One theory is that NAV changed something that Office detect and repair or
reinstall could not fix.
I could (dis)prove this theory by uninstalling and re-installing NAV, but as
things are now working, I cannot justify the time.
If theory proved correct, then I'd have to again uninstall and re-install
Office, too time consuming.
Signature

http://www.standards.com/; See Howard Kaikow's web site.
"Howard Kaikow" <kaikow@standards.com> wrote in message news:...

> I got the same error as follows:
> Using either of the subs below, I am unable to create a Word object and
get
> the same error message in both cases.
>
> I know that I ran analogous code successfully on 22 July 2004, with NAV
> 2003.
>
> As far as I know, the only software installed since then was NAV 2004 on
24
> August 2004.
>
[quoted text clipped - 61 lines]
> >
> > I'm at the end of my tether with this one and would appreciate any help
at
> > all.
> >
> > Thanks
Spyder - 29 Nov 2004 21:01 GMT
I had this exact scenario.  VB6 w/ Word 2003.  XP Pro SP2.
Worked on laptop with exact setup, failed on desktop.
I really can't say whether I have hit that code in my app since installing
sp2 on XP, but, I had to remove Office and reinstall it.  All is well, now.
I also have Norton AV 2004.

> Can anyone help resolve the cause of the error:
>
[quoted text clipped - 25 lines]
>
> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.