D
Doug Robbins - Word MVP
Hi Chris,
One sure way of controlling the location of the picture is to insert it into
the cell of a table. Put a one row, one column, borderless table where you
want the picture to appear and use the following code. In this example, I
am putting the picture into the second cell in the fifth row of the table
and also sizing the picture to fit the cell dimensions - while maintaining
the aspect ratio of the picture:
'Insert logo
WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes.AddPicture
FileName:=Me.Logo
'Re-size logo
oheight = WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1).Height
owidth = WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1).Width
If oheight > 72 * 1.6 Then
With WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1)
.Height = 72 * 1.6
.Width = owidth * 72 * 1.6 / oheight
End With
End If
If oheight < 72 * 0.68 Then
With WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1)
.Height = 72 * 1.6
.Width = owidth * 72 * 1.6 / oheight
End With
End If
oheight = WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1).Height
owidth = WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1).Width
If owidth > 72 * 1.6 Then
With WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1)
.Width = 72 * 1.6
.Height = oheight * 72 * 1.6 / owidth
End With
End If
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
One sure way of controlling the location of the picture is to insert it into
the cell of a table. Put a one row, one column, borderless table where you
want the picture to appear and use the following code. In this example, I
am putting the picture into the second cell in the fifth row of the table
and also sizing the picture to fit the cell dimensions - while maintaining
the aspect ratio of the picture:
'Insert logo
WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes.AddPicture
FileName:=Me.Logo
'Re-size logo
oheight = WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1).Height
owidth = WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1).Width
If oheight > 72 * 1.6 Then
With WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1)
.Height = 72 * 1.6
.Width = owidth * 72 * 1.6 / oheight
End With
End If
If oheight < 72 * 0.68 Then
With WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1)
.Height = 72 * 1.6
.Width = owidth * 72 * 1.6 / oheight
End With
End If
oheight = WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1).Height
owidth = WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1).Width
If owidth > 72 * 1.6 Then
With WordDoc.Tables(1).Cell(5, 2).Range.InlineShapes(1)
.Width = 72 * 1.6
.Height = oheight * 72 * 1.6 / owidth
End With
End If
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP