OBJECT Codeunit 60100 Test Word Automation { OBJECT-PROPERTIES { Date=17-05-11; Time=[ 9:19:47]; Modified=Yes; Version List=TEST; } PROPERTIES { OnRun=VAR wdAppGaut@1000000003 : Automation "{00020905-0000-0000-C000-000000000046} 8.4:{000209FF-0000-0000-C000-000000000046}:'Microsoft Word 12.0 Object Library'.Application"; wdDocGaut@1000000002 : Automation "{00020905-0000-0000-C000-000000000046} 8.4:{00020906-0000-0000-C000-000000000046}:'Microsoft Word 12.0 Object Library'.Document"; wdFindGaut@1000000001 : Automation "{00020905-0000-0000-C000-000000000046} 8.4:{000209B0-0000-0000-C000-000000000046}:'Microsoft Word 12.0 Object Library'.Find"; wdSelectionGaut@1000000000 : Automation "{00020905-0000-0000-C000-000000000046} 8.4:{00020975-0000-0000-C000-000000000046}:'Microsoft Word 12.0 Object Library'.Selection"; wdView@1000000010 : Automation "{00020905-0000-0000-C000-000000000046} 8.4:{000209A5-0000-0000-C000-000000000046}:'Microsoft Word 12.0 Object Library'.View"; Field@1000000005 : Text[30]; Value@1000000006 : Text[30]; Value1@1000000007 : Integer; Value0@1000000008 : Integer; Counter@1000000004 : Integer; ReplaceAll@1000000009 : Integer; Text001@1000000011 : TextConst 'ENU=With searching in Header;NLD=Met zoeken in koptekst'; WithSearching@1000000012 : Boolean; BEGIN WithSearching := FALSE; IF CONFIRM(Text001) THEN WithSearching := TRUE; IF ISCLEAR(wdAppGaut) THEN CREATE(wdAppGaut, TRUE, TRUE); wdAppGaut.Visible(TRUE); //Show Word wdDocGaut := wdAppGaut.Documents.Add; //Add New Document wdSelectionGaut := wdAppGaut.Selection; Value0 := 0; Value1 := 1; Field := 'Field'; Value := 'Value'; ReplaceAll := 2; IF WithSearching THEN BEGIN wdFindGaut := wdDocGaut.Sections.Item(1).Headers.Item(1).Range.Find; // Search in Header //wdFindGaut.Execute(Field, Value0, Value1, Value0, Value0, Value0, Value1, Value1, Value0, Value, ReplaceAll); END; wdSelectionGaut.TypeText := 'This is an example'; //Show all markings wdView := wdAppGaut.ActiveWindow.View; wdView.ShowAll(TRUE); END; } CODE { BEGIN END. } }I hope someone can help to solve the problem. I think a simple command must be used, but which one?????? :-k