View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jamie Oglethorpe Jamie Oglethorpe is offline
external usenet poster
 
Posts: 3
Default C# Automation problem

I don't have VS 2005 Tools for MS Office, so I am trying to do this the old
fashioned way with automation.

I have created the Excel application, and am trying to set the document
properties, such as Title and Author. To that end I have a reference to
Microsoft.Office.Core and am trying to assign
workbook.BuiltinDocumentProperties to a DocumentProperties object (with the
appropriate casting).

I get this exception:

System.InvalidCastException : 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)).

Help!