M
Mary
Ihave created a procedure (based on a previous post) to
insert photographs into a table cell.
I have a problem and don't know whether it can be solved
and was wondering if anyone had any advice.
When choosing to insert a landscape photo the size of the
photo work wonderfully, however, when I insert a portrait
photo I want the ratio to be set by the height
measurement. The width always seems to take priority -
is there any way around this.
Please see my code below, many thanks:-
Dim Myrange As Range
Dim MyWidth As Long
Const FixWidth As Long = 147.4
If Selection.Information(wdWithInTable) Then
With Dialogs(wdDialogInsertPicture)
If .Show Then
Set Myrange = Selection.Cells(1).Range
If Myrange.InlineShapes.Count > 0 Then
With Myrange.InlineShapes(1)
.LockAspectRatio = msoTrue
.Height = 138.5
MyWidth = 147.4
.Width = 147.4
'.Height = .Height * (FixWidth / MyWidth)
End With
Else
With Myrange.ShapeRange
.LockAspectRatio = msoTrue
.Width = 147.4
.Left = wdShapeCenter
.WrapFormat.Type = wdWrapInline
.WrapFormat.Side = wdWrapBoth
.LockAnchor = False
.IncrementLeft 1#
.IncrementTop 73#
End With
End If
End If
End With
End If
insert photographs into a table cell.
I have a problem and don't know whether it can be solved
and was wondering if anyone had any advice.
When choosing to insert a landscape photo the size of the
photo work wonderfully, however, when I insert a portrait
photo I want the ratio to be set by the height
measurement. The width always seems to take priority -
is there any way around this.
Please see my code below, many thanks:-
Dim Myrange As Range
Dim MyWidth As Long
Const FixWidth As Long = 147.4
If Selection.Information(wdWithInTable) Then
With Dialogs(wdDialogInsertPicture)
If .Show Then
Set Myrange = Selection.Cells(1).Range
If Myrange.InlineShapes.Count > 0 Then
With Myrange.InlineShapes(1)
.LockAspectRatio = msoTrue
.Height = 138.5
MyWidth = 147.4
.Width = 147.4
'.Height = .Height * (FixWidth / MyWidth)
End With
Else
With Myrange.ShapeRange
.LockAspectRatio = msoTrue
.Width = 147.4
.Left = wdShapeCenter
.WrapFormat.Type = wdWrapInline
.WrapFormat.Side = wdWrapBoth
.LockAnchor = False
.IncrementLeft 1#
.IncrementTop 73#
End With
End If
End If
End With
End If