Image in word table cell

by davehook at 2012-10-01 08:50:36

I create a table in word with cells 1 to 5 coming from a csv, this works fine. In cell 6 I want to place a small png icon (the same one for all records) Any idea how I code this?
$UserTable =$Word.ActiveDocument.Tables.Add($Word.Selection.Range, 1, 6)
$UserTable.Cell(1,1).Range.Text = "Post No"
$UserTable.Cell(1,2).Range.Text = "Force/Contract"
$UserTable.Cell(1,3).Range.Text = "Last Audit Date"
$UserTable.Cell(1,4).Range.Text = "Comment"
$UserTable.Cell(1,5).Range.Text = "Type of Contract"
$UserTable.Cell(1,6).Range.Text = "status"
$TableRowPosition = 2
foreach ($ObjItem in $wordtext) {
$UserTable.Cell($TableRowPosition,1).Range.Text = $ObjItem.postno
$UserTable.Cell($TableRowPosition,2).Range.Text = $ObjItem.force
$UserTable.Cell($TableRowPosition,3).Range.Text = $ObjItem.lastaudited
$UserTable.Cell($TableRowPosition,4).Range.Text = $ObjItem.comment
$UserTable.Cell($TableRowPosition,5).Range.Text = $ObjItem.HWR

Many thanks
by surveyor at 2012-10-02 03:57:19
A quick recording in Word shows this in VBA, maybe it helps?
Selection.InlineShapes.AddPicture FileName:="D:\Bilder\Logos\AAA.bmp", LinkToFile:=False, SaveWithDocument:=True
by davehook at 2012-10-03 04:37:20
Any body tell me what the last line of the above script (for cell 6) would read as im obviously doing this wrong? The image copies multiple times into cel 1, 1

by davehook at 2012-10-03 05:16:39
Worked it out


thanks all