Excel Embed Images

Thank you
The script editor has full disk access. The specific error → error “Microsoft Excel got an error: Can’t make or move that element into that container.” number -10024

The insert picture function is not accessible using Applescript. Neither with VBA.
The only option we have is to use Gui scripting because clicking on Ribbon’s controls is also broken. Here is how to do:

tell application "System Events" to tell (application process "Microsoft Excel")
	delay 0.2
	click radio button 11 of tab group 1 of window 1 -- "Picture format" tab
	delay 0.2
	click button 1 of group 1 of scroll area 1 of tab group 1 of window 1 -- "Place image in cell" button
end tell

(you may need to change the tab indexes and the delay duration…)

Many thanks for this Jonas, it was my thinking from the start…

I have no experience of GUI scripting so Im going to need a bit more help as Ive got a error with it:

tell application “Microsoft Excel”

activate

get cell “A5” of worksheet 1 of workbook 1

cell “A5” of worksheet 1 of workbook 1

set value of cell “A5” of worksheet 1 of workbook 1 to “DSCF3408.jpg”

get cell “B5” of worksheet 1 of workbook 1

cell “B5” of worksheet 1 of workbook 1

set value of cell “B5” of worksheet 1 of workbook 1 to “1”

get cell “C5” of worksheet 1 of workbook 1

cell “C5” of worksheet 1 of workbook 1

get left position of cell “C5” of worksheet 1 of workbook 1

→ 130.0

get top of cell “C5” of worksheet 1 of workbook 1

→ 64.0

make new picture at beginning of worksheet 1 of workbook 1 with properties {file name:file “Macintosh HD:Users:imac3:Desktop:thumbnails:DSCF3408.jpg”, height:130, width:173.333333333333, top:64.0, left position:130.0, placement:placement move}

picture 1 of worksheet 1 of workbook 1

end tell

tell application “System Events”

click radio button 11 of tab group 1 of window 1 of application process “Microsoft Excel”

error number -1719 from radio button 11 of tab group 1 of window 1 of application process “Microsoft Excel”

Result:

error “System Events got an error: Can’t get radio button 11 of tab group 1 of window 1 of application process "Microsoft Excel". Invalid index.” number -1719 from radio button 11 of tab group 1 of window 1 of application process “Microsoft Excel”

Could you, please, edit your post by selecting the whole code and clicking on the “Preformatted text” button, then change the arrows before the results to "-- " (this will comment out the lines).
capture 002

As I said, you have to verify the Picture format tab index in the Ribbon:
In my version of Excel it’s 11 because I have added the Developer and the Abobe PDF tabs.
For you, it should be 9. But again, you have to check it out.
To make the Picture format tab appear, insert any picture in a Worksheet.