Insert-Image
Command Description
Insert an image at the current cursor position in a Word document
Command Prototype
Word.InsertPicture(objWord,sPath,optionArgs)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
objWord | True | expression | objWord | Word document object |
sPath | True | path | '''C:\Users''' | Path of the image file |
linkToFile | None | boolean | True | Whether to copy the inserted image (the default is yes) |
saveWithDocument | None | boolean | True | Whether to save the inserted image into the Word document (the default is yes) |
Demo
/************************************Insert picture************** ************************
Command prototype:
Word.InsertPicture(objWord,sPath,optionArgs)
Input parameters:
objWord--Word document object
sPath--image file path
linkToFile--Whether to copy the inserted picture
saveWithDocument - whether to save the inserted picture to the Word document
*********************************************************************************/
Dim objWord
objWord = Word.Open('''C:\Users\Administrator\Desktop\Standardization Implementation Notes.docx''',"xw4131221","",true)
Word.SelectRow(objWord,3,3)
Word.InsertPicture(objWord,'''C:\Users\Administrator\Pictures\Camera Roll\001.jpg''',{"linkToFile":true,"saveWithDocument":true})