Board index » delphi » OLE to Word 95/97

OLE to Word 95/97

I have a Delphi 3 app that uses a word doc via OLE.

I need to search for a particular character (in this case the | character)
and retrieve the following 5 characters to delphi.

I have seen examples of search but does anyone know how to get just the next
5 characters back to delphi in a string?

Any help would be greatly appreciated.

 

Re:OLE to Word 95/97


Something like this is a very simple approach--this returns a six-character
string beginning with the '|' character. (This is Word97 only--for Word95
you'lll have to go to Word.Basic for your connection)

the constants are defined in Word's type library--I always import the
library even when defining msWord as an OleVariant.

var myStr : string;

  msWord.Selection.Find.Text := '|';
  msWord.Selection.Find.Execute;
  msWord.Selection.MoveRight(Unit:=wdCharacter, Count:=5, Extend:=wdExtend);
  myStr := msWord.Selection;

Quote
microfast wrote in message <6i2hmj$8...@forums.borland.com>...
>I have a Delphi 3 app that uses a word doc via OLE.

>I need to search for a particular character (in this case the | character)
>and retrieve the following 5 characters to delphi.

>I have seen examples of search but does anyone know how to get just the
next
>5 characters back to delphi in a string?

>Any help would be greatly appreciated.

Other Threads