Skip to main content

Get-Document-Path

Command Description

Get the file path of an opened Word document

Command Prototype

sRet = Word.GetPath(objWord)

Parameter Description

ParameterRequiredTypeDefaultDescription
objWordTrueexpressionobjWordWord document object

return

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

Demo

/************************************Get document path************* **************************** 
Command prototype:
Word.GetPath(objWord)
Input parameters:
objWord--Word document object
Outgoing reference:
sRet -- The result returned after the command is run
*********************************************************************************/
Dim objWord , sRet
objWord = Word.Open('''C:\Users\Administrator\Desktop\Standardization Implementation Notes.docx''',"xw4131221","",true)
Word.SelectRow(objWord,3,3)
sRet = Word.GetPath (objWord)
TracePrint ($ PrevResult)