OleContainer1.CreateObjectFromFile(myFileName, False);
OleContainer1.Modified := False;
OleContainer1.Run;
OleContainer1.BringToFront;
OleContainer1.Visible := True;
OleContainer1.DoVerb(ovPrimary);
...
...
Props :=
FOleContainer.OleObject.Application.ActiveDocument.BuiltInDocumentProperties
;
edtTitle.Text := Props.Item[wdPropertyTitle].Value;
edtSubject.Text := Props.Item[wdPropertySubject].Value;
edtAuthor.Text := Props.Item[wdPropertyAuthor].Value;
edtManager.Text := Props.Item[wdPropertyManager].Value;
edtCompany.Text := Props.Item[wdPropertyCompany].Value;
edtCategory.Text := Props.Item[wdPropertyCategory].Value;
edtKeywords.Text := Props.Item[wdPropertyKeywords].Value;
mnoComments.Text := Props.Item[wdPropertyComments].Value;
The code above does not retrieve the properties nor does it get an error.
When Props is initialized from a TWordApplication, the same code works.
Props := WordApp.ActiveDocument.BuiltInDocumentProperties;
Thanks
Dan Gaskin
Don't use the ActiveDocument property with an OleContainer.
The OleContainer.OleObject /is/ the document in question.
var
Doc: OleVariant;
..
Doc := OleContainer1.OleObject;
edtTitle.Text :=
Doc.BuiltInDocumentProperties[wdPropertyTitle].Value;
edtSubject.Text :=
Doc.BuiltInDocumentProperties[wdPropertySubject].Value;
--
Deborah Pate (TeamB) http://delphi-jedi.org
TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html