VBA crop images

Hello,


I got a problem with a macros which have to resize imported images, crop them to specific size and ordering them 3x3 per page. Can you help me with the code?

For the moment I succeeded to make this:

Sub Macro1()

    '15 sm = 5.905512
    '13 sm = 5.11811
    '10 sm = 3.937008
    '9 sm = 3.543307
    
    NumberImages = 2
    DimensionX = 5.905512
    DimensionY = 3.937008
    
    ActiveDocument.ReferencePoint = cdrCenter

    For i = 1 To NumberImages
    
        If ActiveLayer.Shapes(i).SizeWidth > ActiveLayer.Shapes(i).SizeHeight Then ActiveLayer.Shapes(25).Rotate 90#
        
        ActiveLayer.Shapes(i).SetSize 0, DimensionY
        If ActiveLayer.Shapes(i).SizeWidth < DimensionX Then
            ActiveLayer.Shapes(i).SetSize DimensionX, 0
        End If
    Next

    
End Sub

But cropping each image to the dimensions don't want to work. Any help with arranging 3x3 per page and centering them on each page A3 will be great.

Parents
  • From your code I understand you are working with 2 sizes of images (probably photos)

    1. 9x13 cm - 3 images imported, resized and imposed 3x3 on A3 (42x29.7 cm)

    2. 10x15 cm - 2 images imported, resized and imposed 2x2 on A3 (42x29.7 cm)

     

    I have included another size to my code - 13x18 cm - 2 images imported, resized and imposed 2x2 on A3 (42x29.7 cm)

     

    Attached code is also creating rectangle around the group of ordered pictures with bleed 3 mm.

     

    Best regards,

     

    Mek

    ResizeAndOrdering.gms

Reply Children