The following examples illustrates the use of DDE with Word for Windows and assumes that Word is running and the currently open document contains a bookmark called "mark" some where within the document.
To insert the text "hello world" at the bookmark, enter the following at the command prompt :-
DDEPOKE WinWord Document1 mark "hello world"
To goto the text in the bookmark and highlight it, enter the following at the command prompt :-
DDEEXEC WinWord Document1 "[EditGoTo ""mark""]"
To format the text in the bookmark to Arial, with a point size of 20 and using the bold attribute, enter at the command prompt :-
DDEEXEC WinWord Document1 "[FormatCharacter ""Arial"", ""20"", 1]"
This example assumes that the bookmark has been highlighted as in example 2.
To retrieve the text in the bookmark, enter at the command prompt :-
DDEREQ WinWord Document1 mark
The environment variable DDEREQ with contain the value 0 and DDEREQ.0 with contain the text retrieved from the bookmark.