Resize images within a Word document

I'm trying to write a VB program that will open a Word document and resize all the images contained within.  This document may have as many as 20 images.  I have tried the following with little success. The first image resizes but the remaining images do not.

   Dim objWordApp As New Word.Application
   Dim objWordDoc As New Word.Document
   
   Set objWordDoc = objWordApp.Documents.Add("WordDocument.doc")

   ' Loop through the images
   For cnt = 0 To (objWordDoc.InlineShapes.Count - 1)
      objWordDoc.InlineShapes(cnt).Width = 250
      objWordDoc.InlineShapes(cnt).Height = 250
   Next

   objWordDoc.Save
TheChosAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
JR2003Connect With a Mentor Commented:
Dim iShape As InlineShape
For Each iShape In ActiveDocument.InlineShapes
    iShape.Width = 250
    iShape.Height = 250
Next iShape
0
 
TheChosAuthor Commented:
Excellent!

It's very obvious after reading your solution.  I can't believe I didn't think of it.  Thanks again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.