Author: Lou Adler
How to insert text at bookmark positions of a Word document
Answer:
1 procedure WordBookInsert(v: OleVariant; sgoto, sdata: string);
2 begin3 try4 {make sure we have passed a word.application level variant}5 ifnot varisempty(v) then6 begin7 V.Selection.goto(What := wdGoToBookmark, Name := sgoto);
8 V.Selection.TypeText(Text := SDATA);
9 end;
10 except11 {trap OLE errors and display message if it fails}12 on E: sysutils.exception do13 begin14 showmessage(e.message);
15 end;
16 end;
17 end;