Home All Groups Group Topic Archive Search About

Unable to cast COM object

Author
29 Oct 2007 9:24 AM
Simon Pollock
I have a small VB.NET 2005 application which automates Access 2007. The application runs fine on the development machine. However, on the target machine I get the following runtime error. Access 2007 is installed on both machines. How can I resolve this problem?

"13: Unable to cast COM object of type..."



Thanks, Simon

Author
29 Oct 2007 2:51 PM
Mr. Arnold
Do you have a tlb for the DLL on both machines?
  "Simon Pollock" <italfondiario@newsgroup.nospam> wrote in message news:%23RALR2gGIHA.3400@TK2MSFTNGP03.phx.gbl...
  I have a small VB.NET 2005 application which automates Access 2007. The application runs fine on the development machine. However, on the target machine I get the following runtime error. Access 2007 is installed on both machines. How can I resolve this problem?

  "13: Unable to cast COM object of type..."



  Thanks, Simon
Author
29 Oct 2007 3:27 PM
Simon Pollock
What's a tlb?
  "Mr. Arnold" <MR. Arn***@Arnold.com> wrote in message news:OjXX2sjGIHA.5980@TK2MSFTNGP04.phx.gbl...
  Do you have a tlb for the DLL on both machines?
    "Simon Pollock" <italfondiario@newsgroup.nospam> wrote in message news:%23RALR2gGIHA.3400@TK2MSFTNGP03.phx.gbl...
    I have a small VB.NET 2005 application which automates Access 2007. The application runs fine on the development machine. However, on the target machine I get the following runtime error. Access 2007 is installed on both machines. How can I resolve this problem?

    "13: Unable to cast COM object of type..."



    Thanks, Simon
Author
29 Oct 2007 5:16 PM
Mr. Arnold
"Simon Pollock" <italfondiario@newsgroup.nospam> wrote in message
news:Ov8xGBkGIHA.4712@TK2MSFTNGP04.phx.gbl...

What's a tlb?

<copied>

COM Type Libraries are binary files with .tlb extension. Usually this files
contain information about COM interfaces and components. To use this
information, type library must be registered on target system.

<end>
http://www.google.com/search?hl=en&q=what+is+a+type+library+file&btnG=Google+Search
Author
30 Oct 2007 5:19 AM
Jialiang Ge [MSFT]
Hello Simon

From your post, my understanding on this issue is: you want to know how to
fix the issue that the automation client throws exception: "Unable to cast
COM object of type¡­" in the target machine, but not in development
machine. If I'm off base, please feel free to let me know.

According to your description, the automation client runs well in the
development environment. However, when it is run on another computer with
Access 2007, it throws the exception. Therefore, my guess is that the
target machine is not installed with Office 2007 PIA (Primary Interop
Assembly). Office 2007 PIA (.NET support of Office) is a group of
assemblies that helps to interoperate between .NET applications and Office
COM objects. If .NET support of Office is not selected when you are
installing Office 2007 in the target machine, the exception "Unable to cast
COM object of type¡­" might be thrown in Office automation clients. To
install Office 2007 PIA, please go to the page:
http://www.microsoft.com/downloads/details.aspx?familyid=59daebaa-bed4-4282-
a28c-b864d8bfa513&displaylang=en and install it in the target machine. Then
run your application again to see if the issue is resolved.

If the suggestion above could not help, would you let me know the type of
your Office automation client? Is it an Office COM Add-in? Is it a VSTO
one? Would you try {} catch the exception in code, print the call stack,
and let me know the line of code that throws the exception? I am looking
forward to your reply.

Sincerely,
Jialiang Ge (jia***@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Author
1 Nov 2007 2:25 AM
Jialiang Ge [MSFT]
Hi Simon,

Would you mind letting me know the result of the suggestions? If you need
further assistance, feel free to let me know. I will be more than happy to
be of assistance.

Have a great day!

Sincerely,
Jialiang Ge  (jia***@online.microsoft.com, remove 'online.')
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.

AddThis Social Bookmark Button