Forum Discussion

nishant's avatar
nishant
New Contributor
14 years ago

Not able to capture text in word document

How to capture text in word document?



We need to select text and store that value for further use. But we are not able to retrieve the selected text using recording tool.


3 Replies

  • Hi,



    What kind of text do you need to select? In what way are you trying to do this?



    You can either copy the text to the clipboard and use it via the Clipboard property, or work with Word via COM and retrieve the needed text using the Word COM object's methods and properties. See the "Clipboard Property" and "Working With COM Objects" help topics.



    You can find plenty of information and samples regarding the Word object model in this MSDN section.
  • nishant's avatar
    nishant
    New Contributor
    See the attached video....

    In notepad Test complete shows the  properties like wText, wSelection, wSelectionStart, wSelectionEnd.....

    But in word document it does not show any of the above properties.....
  • Hi,



    MS Word has its own object reference. The best approach is working with Word via COM. You can obtain the Word COM server ("Word.Application") by using the Sys.OleObject property and use properties and methods that will provide you with the needed information or let you perform the needed actions. Refer to the sources of information I gave you in my previous post.