PDA

View Full Version : Import Multiple Pictures with some specifications into Word



CPR
11-26-2015, 12:15 PM
Hi All!
I have an important problem to solve... I want to import several pictures in a Word File. The source are pictures from a camera, so some in landscape some in portrait with a very high resolution.
The ideal resultvwould:
- compress the pics first (300/600dpi) to keep filesize low and Word do not hang up itself
- arrange the Pics in a given order (so I can switch Pic 23 with Pic 45)
- the final size of the pics are all the same (width/height) but the ratio remains as the original and maximum 4 pics are arranged on 1 DIN A4 page
- below each pic is a description with the file name
- possibly the pic and the description line are in two lines of a table so that all pics and descriptions are fitted in a table

A guy from this forum posted the code below which sounds interesting in the description but gives not a solution for all requirements and unfortunately has an syntax error:
Sub FitPics()
Application.ScreenUpdating = False
Dim Tbl As Table, Ishp As InlineShape
With ActiveDocument
ForEach Tbl In.Tables
ForEach Ishp In Tbl.Range.InlineShapes
With Ishp
.LockAspectRatio = msoTrue
If .Height > .Range.Cells(1).Height Then
.Height = .Range.Cells(1).Height
End If
If .Width > .Range.Cells(1).Width Then
.Width = .Range.Cells(1).Width
End If
If .Width < .Range.Cells(1).Width Then
.Width = .Range.Cells(1).Width
End If
EndWith
Next
Next
EndWith
Application.ScreenUpdating = True
EndSub

Can U help?!?

Thank you very much in advance

gmayor
11-26-2015, 10:22 PM
The syntax errors in the macro are simply due to some missing spaces ForEach should be two words as should EndWith.
Take a look at http://www.gmayor.com/photo_gallery_template.html. A two column format should do more or less what you want. The pictures are insereted in the order they are selected.