#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
There's nothing about the code that would prevent it working in a table. Of course, if the table has a fixed row height or column width smaller than the dimensions you're setting, you won't be able to see the entire resized image.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
Cross-posted at: http://www.vbaexpress.com/forum/show...ge-Not-Working
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
Quote:
I have tested with various image sizes and the code, as I said, works outside a table just fine, but not when pasting inside a table. Any help would be greatly appreciated. |
#5
|
|||
|
|||
I did some more testing and I think I found a point of confusion.
When I wrote that I was pasting images, I mean that I copied an image file from windows explorer and pasted that into Word. When doing this, the code works outside the table but not inside. I just tested opening an image file and copying the image from inside the image viewer and pasting the copied image selection into a table and the code works both indie the table and outside, as expected. Does anyone know how I could get this to work when pasting image files into a table? I have a TON of files to process and coding a solution for this would be wonderful! Many thanks for all of the help! |
#6
|
||||
|
||||
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word - Resize image to specified selected cells' dimensions | FaizanRoshan | Word VBA | 7 | 10-18-2015 03:34 PM |
Insert and resize image | lenguyenleduong | Word VBA | 2 | 05-11-2014 07:23 AM |
Shortcut for image resize | Hatthans | PowerPoint | 0 | 01-06-2014 04:32 PM |
How to resize the image in the header so that it fits the page | Isadora | Excel | 1 | 08-20-2013 06:02 AM |
Image proportional resize not functioning! | alexfcm | PowerPoint | 0 | 09-27-2012 07:22 AM |