Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Applescript Insert picture into word table cell?

How is it done?


I have a cell that I wish to insert a picture from the HD int but I just can't seem to get it to work... I have no problem inserting the picture at the end of the document but not in the cell... thoughts?


Works:


make new inline picture at end of proposal with properties {file name:"Macintosh HD:Users:User:Misc:pict.jpg", save with document:true}


Does not work:

make new inline picture at (get cell from table proposalTable row 3 column 3) with properties {file name:"Macintosh HD:Users:User:Misc:pict.jpg", save with document:true}


thanks!
-J

Posted on May 9, 2011 3:36 PM

Reply
17 replies

Apr 18, 2015 10:21 AM in response to Raphnouf

Hi,


Raphnouf wrote:


Word 2011, my bad :/


Here is the script, with the right paths :

set tfile to "/Users/macbookpro/Pictures/QRCode www.pps4Me.de.png"

set wfile to "/Users/macbookpro/Documents/Scripts/Labels/Frame.docx"

tell application "Microsoft Word"

activate

openwfile

tell active document

set x to text object of cell 1 of row 1 of table 1

makenewinline pictureat before xwith properties {file name:(tfile as string), save with document:true}

end tell

end tell


You must convert the posix path of your image file to mac path, like this :

set tfile to "/Users/macbookpro/Pictures/QRCode www.pps4Me.de.png" as POSIX file as text


Try this script

set tfile to "/Users/macbookpro/Pictures/QRCode www.pps4Me.de.png" as POSIX file as text
set wfile to "/Users/macbookpro/Documents/Scripts/Labels/Frame.docx"
tell application "Microsoft Word"
     activate
     open wfile
     tell active document
          set x to text object of cell 1 of row 1 of table 1
          make new inline picture at before x with properties {file name:tfile, save with document:true}
     end tell
end tell

Applescript Insert picture into word table cell?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.