Resizing images

  • Thread starter Aidan Whitehall
  • Start date
A

Aidan Whitehall

We've got about 500 Word documents, all of which have 4 large images
embedded in them. Each image has been pasted into the document and rescaled,
so that the visible image is about 25% of the original. As a consequence,
each document is around 4-6Mb, and now they all need to be web-accessible
:-\

I was hoping to find a way of programatically looping through each document,
and resizing the image (as opposed to altering it's scale) to reduce the
amount of image information saved within each Word document.

Is this doable all from within Word, or will I need another application to
handle the resizing?

The code below is what I've got so far, which just loops through the
document's images collection, selects it in turn and outputs the size of
each one to MsgBox. First time VBA user, btw (as if you hadn't guessed ;-).
Any pointers? Thanks!


Sub ShowPictures()
Dim i As Integer
Dim objPicture As InlineShape

For i = 1 To ActiveDocument.InlineShapes.Count
Set objPicture = ActiveDocument.InlineShapes(i)
objPicture.Select
MsgBox "Image: " & i & vbCrLf & "Width: " & objPicture.Width &
vbCrLf & "Height: " & _
objPicture.Height & vbCrLf & "Range: " & objPicture.Range.Start & "
to " & objPicture.Range.End
Next
End Sub
 
M

macropod

Hi Aidan,

Saving the documents as HTML files will extract the images at a much lower
resolution, which may be sufficient for your needs. No vba required.

Cheers
 
A

Aidan Whitehall

Saving the documents as HTML files will extract the images at a much lower
resolution, which may be sufficient for your needs. No vba required.

Thanks for the idea. I'd already tried doing a "Format Picture | Compress |
Web/Screen" on each of the large images in the doc, but that only took the
document's size from 6-ish Mb to 5-ish Mb -- not enough of a saving.

A colleague here may have found an alternative -- using a Word to PDF
converter, which spits out a .pdf in the region of 750 Kb, bypassing the
need to manipulate the images.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top