Hi All,
I'm having trouble updating the DocumentProperties in Word 2007. I'm trying
to use an ASPX page writte in VB.NET update the 'Subject' property in a
document. All the methods I've seen suggest something like this:
Dim oWord As New Word.Application
Dim oDoc As Microsoft.Office.Interop.Word.Document
Dim properties As Microsoft.Office.Core.DocumentProperties
oDoc = oWord.Documents.Open("C:\Templates\Saves\Time Table.DOC")
properties = DirectCast(oDoc.BuiltInDocumentProperties, _
Microsoft.Office.Core.DocumentProperties)
properties.Item("Subject").Value = "Test"
However, I get the following error on the DirectCast line:
Unable to cast COM object of type 'System.__ComObject' to interface type
'Microsoft.Office.Core.DocumentProperties'. This ope
ration failed because the QueryInterface call on the COM component for the
interface with IID '{2DF8D04D-5BFA-101B-BDE5-00AA0
044DE52}' failed due to the following error: No such interface supported
(Exception from HRESULT: 0x80004002 (E_NOINTERFACE))
Can anyone suggest an article or a solution to this problem?
Thanks in advance,
Kenny