Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you resize all pics in MS Word? 2

Status
Not open for further replies.

scc

Programmer
Apr 30, 2001
218
0
0
US
I have a document with lots of pictures in it. Is there a way to resize all the pictures at once instead of going through the document and resizing them one by one?

TIA!
 
Hi,

Yes, but only if you want them ALL to be the same size.

Select them all and format/size

Skip,
[sub]
[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue][/sub]

 
If the pictures are 'in-line with text' you can only select them one at a time. In that case, formatting the first one then selecting each of the others in turn and pressing F4 will repeat the formatting. Considerably quicker than going through Format|Picture|size for each one.

Alternatively, you could use a macro but coding it would probably take longer than doing the reformatting manually and may not be worthwhile for a once-off job.

Cheers
 
Code:
Sub ResizeInlines()
  w = InputBox("Width in Inches")
  h = InputBox("Height in Inches")
  For Each ils In ActiveDocument.InlineShapes
     With ils
       .Width = Application.InchesToPoints(w)
       .Height = Application.InchesToPoints(h)
     End With
  Next
End Sub


Skip,
[sub]
[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue][/sub]

 
Hi Skip,

Won't that code affect all in-line shapes, not just in-line pictures?

Cheers
 
Yes.

So if you have other inline shapes, you'll have to control on wdInlineShapePicture
Code:
  if ils.Type = wdInlineShapePicture then


Skip,
[sub]
[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue][/sub]

 
Skip,

Can you walk me through how I would go about implementing this code and then running it in MS Word?

Thanks!
 
Code:
Sub ResizeInlines()
  w = InputBox("Width in Inches")
  h = InputBox("Height in Inches")
  For Each ils In ActiveDocument.InlineShapes
     With ils
       if .Type = wdInlineShapePicture then
         .Width = Application.InchesToPoints(w)
         .Height = Application.InchesToPoints(h)
       end if
     End With
  Next
End Sub
I'd stor this in my Normal, so i could use it in other documents if I wish.

[alt]+[F11] toggles between the document and the VB editor. If the Project Explorer is not open, View/project Explorer.

Open the Normal object. If you don't have a Module, right click in Normal and select Insert Module.

Paste the macro into the module.

Back to the document, Tools/Macro/Macros - select your macro and [Run]



Skip,
[sub]
[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue][/sub]

 
Thanks! Worked great! Always wondered how to add a module to the Normal.dot

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top