Skip to main content

Read-Selected-Text

Command Description

Read the currently selected texts in a Word document

Command Prototype

sRet = Word.Read(objWord)

Parameter Description

ParameterRequiredTypeDefaultDescription
objWordTrueexpressionobjWordWord document object

return

sRet,The variable used to save the output of the command.

Demo

/************************************Read selected text************ **************************** 
Command prototype:
Word.Read(objWord)
Input parameters:
objWord--Word document object
Outgoing reference:
objWord--the return value after the command is run
*********************************************************************************/
Dim objWord , sRet
objWord = Word.Open('''C:\Users\Administrator\Desktop\Standardization Implementation Notes.docx''',"xw4131221","",true)
Word.SetTextPosition(objWord,"must record the defect system problem",0)
sRet = Word.Read (objWord)
TracePrint ($ PrevResult)
Word.SetTextPosition(objWord,"表",0)
sRet = Word.Read (objWord)
TracePrint ($ PrevResult)