R
Rob
I found the code that updates the BuiltInDocumentProperties; and it works
perfectly...the first time.
But if I change 'Your title...' to something else and run it again, it still
has 'Your Title...' in the Title
does anyone know what I am doing wrong that this only works one time per
document.
I am using D6 and Word2003.
Thanks in advance,
Rob
++++++++++++++++
var
WordApp: OLEVariant;
SaveChanges: OleVariant;
begin
try
WordApp := CreateOleObject('Word.Application');
except
Exit;
end;
try
WordApp.Visible := False;
WordApp.Documents.Open(AWordDoc);
WordApp.ActiveDocument.BuiltInDocumentProperties[wdPropertyTitle].Value
:= 'Your Title...';
WordApp.ActiveDocument.BuiltInDocumentProperties[wdPropertySubject].Value
:= 'Your Subject...';
WordApp.ActiveDocument.BuiltInDocumentProperties[wdPropertyKeywords].Value
:= 'Your Keywords...';
WordApp.ActiveDocument.BuiltInDocumentProperties[wdPropertyComments].Value
:= 'Your Comments...';
finally
SaveChanges := wdSaveChanges;
WordApp.Quit(SaveChanges, EmptyParam, EmptyParam);
end;
perfectly...the first time.
But if I change 'Your title...' to something else and run it again, it still
has 'Your Title...' in the Title
does anyone know what I am doing wrong that this only works one time per
document.
I am using D6 and Word2003.
Thanks in advance,
Rob
++++++++++++++++
var
WordApp: OLEVariant;
SaveChanges: OleVariant;
begin
try
WordApp := CreateOleObject('Word.Application');
except
Exit;
end;
try
WordApp.Visible := False;
WordApp.Documents.Open(AWordDoc);
WordApp.ActiveDocument.BuiltInDocumentProperties[wdPropertyTitle].Value
:= 'Your Title...';
WordApp.ActiveDocument.BuiltInDocumentProperties[wdPropertySubject].Value
:= 'Your Subject...';
WordApp.ActiveDocument.BuiltInDocumentProperties[wdPropertyKeywords].Value
:= 'Your Keywords...';
WordApp.ActiveDocument.BuiltInDocumentProperties[wdPropertyComments].Value
:= 'Your Comments...';
finally
SaveChanges := wdSaveChanges;
WordApp.Quit(SaveChanges, EmptyParam, EmptyParam);
end;