View Single Post
 
Old 07-02-2018, 08:01 AM
Grahamers2002 Grahamers2002 is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2018
Posts: 3
Grahamers2002 is on a distinguished road
Default Pasting Image inside Table and Resize Image Not Working

I use the code listed at the end of this post to paste images into Word and resize them. It works fine EXCEPT when I try to use it inside a table cell. When it executes inside a cell, the image is pasted but not resized.

I suspect that the Selection.Start = .Start - 1 is the problem but I don't know how to fix for this issue.

Any help would be greatly appreciated!

Sub FormatCard()
With Selection
.PasteAndFormat (wdPasteDefault) 'Pastes in the content
.Start = .Start - 1 'move the start back one postion to include the image
If .InlineShapes.Count = 1 Then
'resize the image
With .InlineShapes(1)
.Width = InchesToPoints(2.54)
.Height = InchesToPoints(3.47)
.LockAspectRatio = True
End With
End If
End With
End Sub
Reply With Quote