Skip to main content

Rewrite-Document

Command Description

Write content to a Word document and overwrite the original content

Command Prototype

Word.WriteAll(objWord,sText)

Parameter Description

ParameterRequiredTypeDefaultDescription
objWordTrueexpressionobjWordWord document object
sTextTruestring""Write content

Demo

/************************************Rewrite document ************* **************************** 
Command prototype:
Word.WriteAll(objWord,sText)
Input parameters:
objWord--Word document object
sText--write content
*********************************************************************************/
Dim objWord
objWord = Word.Open('''C:\Users\Administrator\Desktop\Standardization Implementation Notes.docx''',"xw4131221","",true)
sRet = Word.ReadAll (objWord)
TracePrint ($ PrevResult)
Word.WriteAll(objWord,"Step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on, step on step on \\n1.Wow.\\n2.Wow\\n3.DiDiDi")
sRet = Word.ReadAll (objWord)
TracePrint ($ PrevResult)