Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2006

Tip: Looking for answers? Try searching our database.

Word tlb - ActiveX component can't create object (again)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob Oldfield - 26 Jun 2006 09:34 GMT
Apologies for the repost, this is due to me not doing it correctly to fit
terms of an MSDN subscription.

I've built a tlb for Word 2000 in VS 2003, and it's failing intermittently
with the error above.  The general idea I'm using is as described in this:

http://www.codeproject.com/dotnet/Office2000usingDotnet.asp?df=100&forumid=12355
5&exp=0&select=1009060


The strange thing is that this seems to be intermittent.

I'm pushing the software out at people via gpo (also including an exe that
calls the same code) and then adding a reference to the tlb to Word.  Running
a Word macro that calls the code was working when first installed but has now
started failing when users - not all of them, just some - log in the next
day.  Running the exe directly consistently works.

Any ideas gratefully received.
"Peter Huang" [MSFT] - 26 Jun 2006 10:30 GMT
Hi Rob,

Here the code is concern of two Typelibs.
1. Word 2000's Typelib
2. WordTest1.tlb per the link your provide

As for the WordTest1.tlb, it has no related with the Word 2000 in nature.

A OfficeCodeBehind code per the link you provide, it is also a .NET class
library.
For any .NET class library, we can expose it to COM by checking the project
property,Register for COM Interop.
And when we build the class library solution which have checked  the
project property,Register for COM Interop, the IDE will generate a tlb.
Commonly it should be ClassLibraryName.tlb.

Once the ClassLibraryName, we can use the .NET library in Unmanaged code
(e.g. vb6) just as the VB6 is calling a legacy COM library.

So far now we need to track what code line cause the error as your provide.

e.g. if the Word Typelib is malfunctional or corrupted, the
createobject("Word.Application") will failed with the error above.

Or if the WordTest1.tlb is corrupted, the code similar will cause the error.
e.g.
Dim o as new WordTest1.MyType
or
Set o = CreateObject("WordTest1.MyType")

A quick way to fix the issue is to re-register the two TypeLib or even
re-install the application.
For Word 2000, we have to reinstall the Word 2000 application, but for
WordTest1.dll, we can use the .NET tool regasm to re-registered it.
e.g.
regasm <path to the WordTest1.dll> /codebase

NOTE: Commonly the steps will also be done by the setup project.

/codebase Creates a Codebase entry in the registry. The Codebase entry
specifies the file path for an assembly that is not installed in the global
assembly cache. You should not specify this option if you will subsequently
install the assembly that you are registering into the global assembly
cache. The assemblyFile argument that you specify with the /codebase option
must be a strong-named assembly.

For detailed information, please take a look at the link below about regasm.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/htm
l/cpgrfassemblyregistrationtoolregasmexe.asp

So far I suggest you remove/reinstall the WordTest1 Application to see if
that works.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Rob Oldfield - 26 Jun 2006 11:06 GMT
Thanks for the response Peter.  I've gone to the machines where it was
failing on Friday to work through your suggestions and, of course, today
everything is working perfectly.  I'll post a follow up message as and when
they decide to go wrong again.

> Hi Rob,
>
[quoted text clipped - 59 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 28 Jun 2006 02:57 GMT
Hi Rob,

Thanks for your quickly reply!
However, if you still have any concern, please feel free to post here.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
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



©2008 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.