#DEFINE wdReplaceNone 0 #DEFINE wdReplaceOne 1 #DEFINE wdReplaceAll 2 Local lcDocument lcDocument = 'c:\myPath\myDoc.doc' * Replacement settings * Replace all <Name> with 'Cetin Basoz' * Replace all <SomeDate> with long format datetime Local Array arrReplace[2,2] && Find what in first col, replacement in 2nd arrReplace[1,1] = '<Name>' arrReplace[1,2] = 'Cetin Basoz' arrReplace[2,1] = '<SomeDate>' arrReplace[2,2] = Transform(Datetime(),'@YL') Local oWord As 'Word.Application' oWord = Createobject('Word.Application') With oWord .Documents.Open(lcDocument) With .ActiveDocument For Each myStoryRange In .StoryRanges ReplaceInRange( myStoryRange, @arrReplace ) Endfor myStoryRange = .Null. EndWith .Visible = .t. .Activate Endwith Function ReplaceInRange Lparameters toRange, taReplacements Local ix For ix=1 To Alen(taReplacements,1) toRange.Find.Execute(taReplacements[ix,1], ; .F., .T.,,,,,,, taReplacements[ix,2], wdReplaceAll) EndforCetin