![]() |
|
#1
|
|||
|
|||
![]()
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! |
#2
|
|||
|
|||
![]()
Can you please post the current macro that you're using?
|
#3
|
|||
|
|||
![]()
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 |
#4
|
||||
|
||||
![]()
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] |
#5
|
|||
|
|||
![]()
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.
|
#6
|
||||
|
||||
![]()
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] |
#7
|
||||
|
||||
![]()
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] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Change font sizes in template | Calab | PowerPoint | 1 | 12-23-2013 09:29 AM |
![]() |
gldntrdrps | Word | 3 | 10-16-2012 01:53 PM |
![]() |
gsrikanth | Excel | 6 | 12-30-2011 08:01 AM |
![]() |
pearce88 | Word | 3 | 11-19-2009 11:27 PM |
![]() |
funky | Word | 3 | 01-14-2009 09:18 PM |