Howdy all. I was searching the net trying to find an easy way to insert an image into Excel when I came accross this VBA Code: http://www.exceltip.com/general-topics-in-vba/insert-pictures-using-vba-in-microsoft-excel.html. I took a few minutes to translate it to AU3 and was pleased to see it actually worked. I thought I would share it in case anyone needed something like it.
#include <Excel.au3>
#include <Array.au3>; for expansion to do many pics from an array
$oExcel = _ExcelBookNew()
$path = @ScriptDir&"\[YOUR IMAGE NAME]"
$targetRange=$oExcel.ActiveSheet.Range("B5:D10")
Func _TestInsertPictureInRange()
_InsertPictureInRange($path, $targetRange)
EndFunc
_TestInsertPictureInRange()
func _InsertPictureInRange($path, $targetRange)
; inserts a picture and resizes it to fit the TargetCells range
Dim $p, $t, $l, $w, $h
; import picture
$p = $oExcel.ActiveSheet.Pictures.Insert($path)
; determine positions
With $targetRange
$t = .Top
$l = .Left
$w = .Offset(0, .Columns.Count).Left - .Left
$h = .Offset(.Rows.Count, 0).Top - .Top
EndWith
; position picture
With $p
.Top = $t
.Left = $l
.Width = $w
.Height = $h
EndWith
$p = "Nothing"
EndFunc
Enjoy.