Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Fri, 30 Nov 2007 10:00:01 -0800,    group: microsoft.public.word.oleinterop        back       


BuilInDocumentProperties not working in Word 2007 with C# / VS2008   
Hello,

I'm automating Word 2007 from an Outlook 2007 Addin done with VAS2008.

But I can't write any document property:
((Microsoft.Office.Core.DocumentProperties)(oWord.ActiveDocument.BuiltInDocumentProperties))[Word.WdBuiltInProperty.wdPropertyCategory].Value =categories;

I get a very strange error:

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 
(E_NOINTERFACE)).

Any idea?

Thanks.
date: Fri, 30 Nov 2007 10:00:01 -0800   author:   Cedric

RE: BuilInDocumentProperties not working in Word 2007 with C# / VS2008   
Found the solution.
See http://support.microsoft.com/kb/303296/en-us

Why the MSDN library still hasn't been updated anywhere is beyond me.

"Cedric" wrote:

> Hello,
> 
> I'm automating Word 2007 from an Outlook 2007 Addin done with VAS2008.
> 
> But I can't write any document property:
> ((Microsoft.Office.Core.DocumentProperties)(oWord.ActiveDocument.BuiltInDocumentProperties))[Word.WdBuiltInProperty.wdPropertyCategory].Value =categories;
> 
> I get a very strange error:
> 
> 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 
> (E_NOINTERFACE)).
> 
> Any idea?
> 
> Thanks.
date: Fri, 30 Nov 2007 10:37:02 -0800   author:   Cedric

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us