Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.DocumentProperties'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{2DF8D04D-5BFA-101B-BDE5-00AA0044DE52}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002

958 views
Skip to first unread message

vsanja...@googlemail.com

unread,
Apr 23, 2007, 11:55:17 AM4/23/07
to
Hi,
Going through similar posts i found that this error is coz of .net 2.0
and we have to run some dll to get it sorted out. But i am not able to
get what dll to run. The exceprion i get is

Unable to cast COM object of type 'System.__ComObject' to interface
type 'Microsoft.Office.Core.DocumentProperties'. This operation failed
because the QueryInterface call on the COM component for the interface
with IID '{2DF8D04D-5BFA-101B-BDE5-00AA0044DE52}' failed due to the
following error: No such interface supported (Exception from HRESULT:
0x80004002


This exception occurs at the line of code
DocumentProperties docprops =
(Microsoft.Office.Core.DocumentProperties)excelApp.ActiveWorkbook.CustomDocumentProperties;

i use the libraries
using Microsoft.Office.Core;
using Microsoft.Office.Tools.Excel;

I want to read the custom properties set on an xls. for this i am
creating an instance of that xls i.e. excelApp...

Can somone please help me out

JoergK

unread,
Apr 24, 2007, 4:35:47 AM4/24/07
to
On Apr 23, 4:55 pm, vsanjay_1...@googlemail.com wrote:
> Hi,
> Going through similar posts i found that this error is coz of .net 2.0
> and we have to run some dll to get it sorted out. But i am not able to
> get what dll to run. The exceprion i get is
>
> Unable to cast COM object of type 'System.__ComObject' to interface
> type 'Microsoft.Office.Core.DocumentProperties'. This operation failed
> because the QueryInterface call on the COM component for the interface
> with IID '{2DF8D04D-5BFA-101B-BDE5-00AA0044DE52}' failed due to the
> following error: No such interface supported (Exception from HRESULT:
> 0x80004002
>
> This exception occurs at the line of code
> DocumentProperties docprops =
> (Microsoft.Office.Core.DocumentProperties)excelApp.ActiveWorkbook.CustomDoc­umentProperties;

>
> i use the libraries
> using Microsoft.Office.Core;
> using Microsoft.Office.Tools.Excel;
>
> I want to read the custom properties set on an xls. for this i am
> creating an instance of that xls i.e. excelApp...
>
> Can somone please help me out

'Microsoft.Office.Core.DocumentProperties' is a .NET type, and it's
not possible to cast
to _ComObject obsiously. Because DocumentProperties is supposedly
wrapping some
kind of COM object there is probably another way to get this object.
ActiveWorkbook.CustomDoc­umentProperties is returning a COM object,
not a wrapped one,
following the docs. The CustomDoc­umentProperties property
indeed exists on another level, but it's from newer libs and not same
(even it's same name,
which may cause the irritation here).

Actually, it has nothing to do with .NET 2.0, it's only that the error
messages come out for
COM/Interop operations are more detailled and no longer silent under
some circumstances.

Finally, this is wrong news group for this questions, at it has
nothing to do with MSHTML.

Joerg
www.netrixcomponent.net

0 new messages