Macro help please - resizing thousands of images

Hi there, wonder if anyone can help me. I'm a bit of a macro amateur....

I have thousands of images that I wish to resize to 210mm wide.

I'm trying this but it's not working:

-Run Temporary Macro

-CTRL A

-CTRL G

-Then I type 210 into the 'width' box

- P (just to centralise it on the page)

-CTRL S

- Close page

- Stop recording

Then I load the images and press CTRL + SHIFT + P to run the temporary macro, it runs, closes the image down but when I go back and check it, it hasn't re-sized it!

Can anyone let me know please what I am doing wrong?

Thanks,

Mark

Parents
No Data
Reply
  • If you want to see what's going on with macros, you will want to record in such a way that you can look at the code.

    If I do the same thing, but record it using "Start recording" rather than "Record Temporary Macro", I get something that is saved. That means that I can use it again later. It also means that I can look at the code in the VBA editor.

    Doing it the same way that you are doing,  I see this:

    Sub Macro5()
        ' Recorded 2017-08-14
        ActivePage.Shapes.All.CreateSelection
        Dim s1 As Shape
        Set s1 = ActiveSelection.Group
        With s1
            .RotationCenterX = 38.715232
            .RotationCenterY = 55.839693
        End With
        ActiveDocument.ReferencePoint = cdrCenter
        s1.SetSize 8.267717, 9.602063
        ActiveDocument.Save
        ActiveDocument.Close
    End Sub

    So, it didn't really record anything like, "resize this such that the width becomes 210 mm, while keeping the selection proportional".  Instead, it only recorded the width and height to apply to that specific selection to achieve a 210 mm width and keep things proportional.

    Run that macro on something else, and it will do something - but it always resizes everything to 8.267717 x 9.602063 inches.

     

Children
No Data