I'm trying to pass the word under the cursor from Microsoft Word to a program.
I'm using olevariants and gone with the following:-
WordApp:=CreateOleObject('Word.Application');
sourcedoc:=wordapp.Documents.Open(WideString(utf8decode(filename)));
And Word opens up fine. Now I want to do something like:-
label1.caption:=sourcedoc.WordUnderTheCursor;
I've tried all sorts of things, but I've simply not hit upon the magic word. I am getting 'Incompatible type for arg no. 1: Got "OleVariant", expected "TTranslateString" when I tried 'sourcedoc.selection.text' and other wild experiments.
Can anyone help, please?