Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-02-2018, 08:01 AM
Grahamers2002 Grahamers2002 is offline Pasting Image inside Table and Resize Image Not Working Windows 10 Pasting Image inside Table and Resize Image Not Working Office 2016
Novice
Pasting Image inside Table and Resize Image Not Working
 
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
  #2  
Old 07-02-2018, 03:21 PM
macropod's Avatar
macropod macropod is offline Pasting Image inside Table and Resize Image Not Working Windows 7 64bit Pasting Image inside Table and Resize Image Not Working Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 07-02-2018, 03:41 PM
macropod's Avatar
macropod macropod is offline Pasting Image inside Table and Resize Image Not Working Windows 7 64bit Pasting Image inside Table and Resize Image Not Working Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #4  
Old 07-02-2018, 04:03 PM
Grahamers2002 Grahamers2002 is offline Pasting Image inside Table and Resize Image Not Working Windows 10 Pasting Image inside Table and Resize Image Not Working Office 2016
Novice
Pasting Image inside Table and Resize Image Not Working
 
Join Date: Jul 2018
Posts: 3
Grahamers2002 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
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.
Thanks for the cross-posting tip. Duly noted!

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.
Reply With Quote
  #5  
Old 07-02-2018, 04:32 PM
Grahamers2002 Grahamers2002 is offline Pasting Image inside Table and Resize Image Not Working Windows 10 Pasting Image inside Table and Resize Image Not Working Office 2016
Novice
Pasting Image inside Table and Resize Image Not Working
 
Join Date: Jul 2018
Posts: 3
Grahamers2002 is on a distinguished road
Default

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!
Reply With Quote
  #6  
Old 07-02-2018, 04:49 PM
macropod's Avatar
macropod macropod is offline Pasting Image inside Table and Resize Image Not Working Windows 7 64bit Pasting Image inside Table and Resize Image Not Working Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

See: https://www.msofficeforums.com/word-...html#post47919
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pasting Image inside Table and Resize Image Not Working 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

Other Forums: Access Forums

All times are GMT -7. The time now is 01:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft