
Wordに貼り付けた画像を変更するスクリプトを作ってみました。
例

たとえば、このような「猫」の画像を変更して「クラゲ」の画像にしてみたいと思います。
$word = New-Object -ComObject "Word.Application" $word.Visible = $true $word.Documents.Open("C:\work\word\test02.docx") #位置やサイズを記憶 $left = $word.ActiveDocument.Shapes(1).Left $top = $word.ActiveDocument.Shapes(1).Top $width = $word.ActiveDocument.Shapes(1).Width $height = $word.ActiveDocument.Shapes(1).Height #一度削除する $word.ActiveDocument.Shapes(1).Delete #再度画像を貼り付け $word.ActiveDocument.Shapes.AddPicture("C:\work\word\kurage.jpg", $false, $true, $left, $top, $width, $height)ポイントは、一度画像を削除してから、再度画像を貼り付けてるところです。どうやら既存のオブジェクトの画像を変更することは出来ないようです。
実行結果

スポンサーリンク