Solved

Resize images within a Word document

Posted on 2004-08-17
2
201 Views
Last Modified: 2011-09-20
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
0
Comment
Question by:TheChos
2 Comments
 
LVL 18

Accepted Solution

by:
JR2003 earned 500 total points
ID: 11823532
Dim iShape As InlineShape
For Each iShape In ActiveDocument.InlineShapes
    iShape.Width = 250
    iShape.Height = 250
Next iShape
0
 

Author Comment

by:TheChos
ID: 11823617
Excellent!

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now