PDA

View Full Version : [SLEEPER:] Pasting Image inside Table and Resize Image Not Working



Grahamers
07-02-2018, 08:07 AM
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

macropod
07-02-2018, 03:42 PM
Cross-posted (and answered) at: http://www.msofficeforums.com/drawing-graphics/39500-pasting-image-inside-table-resize-image-not.html
Please read VBA Express' policy on Cross-Posting in item 3 of the rules: http://www.vbaexpress.com/forum/faq.php?faq=new_faq_item#faq_new_faq_item3