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
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