Solved

Resize images within a Word document

Posted on 2004-08-17
2
202 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

785 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