Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-01-2017, 03:59 AM
menander menander is offline How to change original image sizes in Word Windows 10 How to change original image sizes in Word Office 2013
Novice
How to change original image sizes in Word
 
Join Date: Mar 2017
Posts: 3
menander is on a distinguished road
Default How to change original image sizes in Word

Hi,



I have a macro that will change the sizes of all my images in a document and it works great, but my problem is this...
When you insert an image into Word and then change its shape, the word document then stores two versions of that image. The original image size and your new sized image version displayed on screen. What I want to do is find a macro that will change the original size of the image that is imported into Word, not just the second version of the image.

I have some documents that have hundreds of images in them and I want to convert them into epubs. But when I do this the software creates the ePub with the original large image sizes that were first inserted into the Word document - not the second small version sizes that I have used my macro to create and that show on screen. I have tried compressing all images, but it doesn't work on all of them for some reason - only 90% or so are resized.

Is it possible to use VBA to actually change the original image size of the first version of an image inserted to a specific height, while retaining the aspect ratio? Please note: I can already change all the images in the document, but it is not changing the original image size stored by Word and later used in my epubs.

Thanks all for your help!
Reply With Quote
  #2  
Old 03-01-2017, 08:22 AM
dwirony dwirony is offline How to change original image sizes in Word Windows 7 64bit How to change original image sizes in Word Office 2003
Advanced Beginner
 
Join Date: Oct 2016
Posts: 49
dwirony will become famous soon enough
Default

Can you please post the current macro that you're using?
Reply With Quote
  #3  
Old 03-01-2017, 08:35 AM
menander menander is offline How to change original image sizes in Word Windows 10 How to change original image sizes in Word Office 2013
Novice
How to change original image sizes in Word
 
Join Date: Mar 2017
Posts: 3
menander is on a distinguished road
Default

DesiredHeight = InputBox("Enter desired height for images:", , 400)
For Each ishape In ActiveDocument.InlineShapes
With ishape
ImageWidth = .Width
ImageHeight = .Height
NewHeight = DesiredHeight
NewWidth = Round(NewHeight * ImageWidth / ImageHeight)
.Height = NewHeight
.Width = NewWidth
End With
Next
Reply With Quote
  #4  
Old 03-02-2017, 12:02 AM
macropod's Avatar
macropod macropod is offline How to change original image sizes in Word Windows 7 64bit How to change original image sizes in Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,375
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

Quote:
Originally Posted by menander View Post
my problem is this...
When you insert an image into Word and then change its shape, the word document then stores two versions of that image. The original image size and your new sized image version displayed on screen.
You could avoid that by allowing Word to compress the images and, if they're cropped, discard the cropping data.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 03-03-2017, 02:46 AM
menander menander is offline How to change original image sizes in Word Windows 10 How to change original image sizes in Word Office 2013
Novice
How to change original image sizes in Word
 
Join Date: Mar 2017
Posts: 3
menander is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
You could avoid that by allowing Word to compress the images and, if they're cropped, discard the cropping data.
Hi, I tried that, but Word doesn't compress all the images in a large file of images. For some reason it leaves some the original size. There must be a way to code vba to make it delete the original large version of the image and only retain the smaller file info. I've tried changing the inline images to shapes etc, but still can't work out a way to do it.
Reply With Quote
  #6  
Old 03-02-2017, 12:39 AM
macropod's Avatar
macropod macropod is offline How to change original image sizes in Word Windows 7 64bit How to change original image sizes in Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,375
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...-sizes-in-Word
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 03-05-2017, 01:58 PM
macropod's Avatar
macropod macropod is offline How to change original image sizes in Word Windows 7 64bit How to change original image sizes in Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,375
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

Only bitmap images (e.g. jpg, png, gif) can be compressed; vector images can't - but the very nature of such images means they don't require compression. Whether a given bitmap image will compress depends on its existing resolution and compression as inserted into the document. Changing between inline and wrapped formats makes no difference to the compression.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change font sizes in template Calab PowerPoint 1 12-23-2013 09:29 AM
How to change original image sizes in Word Header Footer - can not change sizes gldntrdrps Word 3 10-16-2012 01:53 PM
How to change original image sizes in Word data change how to convert to original gsrikanth Excel 6 12-30-2011 08:01 AM
How to change original image sizes in Word Need help copy and pasting from internet to word, font change sizes. pearce88 Word 3 11-19-2009 11:27 PM
How to change original image sizes in Word Type spacing and point sizes in Word funky Word 3 01-14-2009 09:18 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:13 PM.


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