Discussion:
Excel 2008: insert picture from file
(too old to reply)
iGods
2010-04-19 23:10:11 UTC
Permalink
Hello Scripters, had a real head scratcher here that I was hoping
someone could help me with.

I'm trying to script picture replacements in an Excel 2008
spreadsheet.The images ogitinal exist in the spreadsheet, and the
replacements are sitting in a folder next to the document.

I cannot figure out how to do either a Change Picture or Insert
Picture/From File within Applescript.

I did come across the ability to throw up an Insert Picture/From File *dialog*:

tell application "Microsoft Excel"
show (get dialog dialog insert picture)
end tell

... but, I don't want the dialog, I want the script to avoid the dialog
altogether. Oddly, there doesn't seem to be a "dialog insert picture"
constant... or a Change Picture menu item for that matter (the "Change
Picture" command appears to be available only from the Contextual Menu).

Even if I *did* choose to do it via UI Scripting, there doesn''t even a
seem to be a way to get the result of the show (get dialog dialog
insert picture) command.

One has to wonder just what drugs Microsoft was on when they missed
this in their otherwise very extensive Applescript dictionary.

Anyway, has anyone gotten around this, or perhaps someone could pass
along their strategy for updating images? I *cannot* use OLE image
linking, since the document I'm working on has been cloned from a
different project, and any OLE links would be associated with the
original client, not the intended one.

Any help would be massively appreciated. Thanks to all.
Dave Balderstone
2010-04-19 23:48:13 UTC
Permalink
Post by iGods
Any help would be massively appreciated. Thanks to all.
You have to address either the sheet or the worksheet (try both).

Looking at the dictionary, the insert command needs an enumeration,
either "after" or "before".

And there's a difference between "picture" and "picture file".

You'll need to try different variations. The log is your friend...
Loading...