I am trying to set bookmarks in a work document from my delphi application, but i cant seem to get it to work properly.
I have this code that i am using currently:
procedure TOpenCaseFrm.Button2Click(Sender: TObject);
S : Selection;
R : Range;
D : _Document;
B : Bookmark;
V : olevariant;
// create new doc based on your template
V := 'c:\test.doc';
D := WordApplication1.Documents.Add(V, EmptyParam, EmptyParam, EmptyParam);
// put your data in the bookmarks
V := 'Test';
R := D.Bookmarks.Item(V).Range;
R.InsertBefore('my inserted data');
But as you can see it is actually inserting the text im passing before the actually bookmark. What i want to do is actually replace the bookmark with the text that i am passing.
Also if you can help how can i alter this procedure to print the document and close the document in background.
Your help would be greatly appreciated.
Thank you in advance.