Board index » delphi » Urgent: How to change properties of MS Word document

Urgent: How to change properties of MS Word document

I tried with BuiltInDocumentProperties property of OLE object, but it
seems like they are read only and documentation which I have (MS Word
help file) is very poor.
It's urgent (like always) !
Thank you, Jure
 

Re:Urgent: How to change properties of MS Word document


BuiltInDocumentProperties is a collection, and is distinct from the
individual items within the collectio. Although the collection is
read-only, the items within the collection are read/write.

Here is an example in VBA:

'=====================================
Sub Test()

Dim p As DocumentProperties, t As String

Set p = ThisDocument.BuiltInDocumentProperties

t = p("Title")                ' Get the title
p("Title") = "A test"      ' Set the title
t = p("Title")                ' Get the title again - should now be "A
test"

End Sub

'=====================================

A handy tip:

Always test your code in VBA first, before you attempt to do it in Delphi.
This will save you many fruitless hours of debugging.

Regards,
Edward Benson.

Jure Pirs <jure.p...@siol.net> wrote in article
<36666065.3004...@forums.borland.com>...

Quote
> I tried with BuiltInDocumentProperties property of OLE object, but it
> seems like they are read only and documentation which I have (MS Word
> help file) is very poor.
> It's urgent (like always) !
> Thank you, Jure

Other Threads