Please Help- Add a rectangle in all pages different sizes

Hello, I would like to know if someone could help me with a macro.

In my work I export many images, and I use the macro to export all pages.

I have a file with 900 images to export but they ask me to add a line around the image, they are all of different sizes.

I would like to know if someone can help me with a macro to be able to add a rectangle to all the pages with its corresponding size.

please and thanks in advance

Dim s1 As Shape
Set s1 = ActiveLayer.CreateRectangle(0#, 11#, 8.5, 0#)
s1.Rectangle.CornerType = cdrCornerTypeRound
s1.Rectangle.RelativeCornerScaling = True
s1.Outline.SetPropertiesEx 0.010417, OutlineStyles(0), CreateCMYKColor(0, 0, 0, 50), ArrowHeads(0), ArrowHeads(0), cdrFalse, cdrFalse, cdrOutlineButtLineCaps, cdrOutlineMiterLineJoin, 0#, 100, MiterLimit:=5#, Justification:=cdrOutlineJustificationMiddle
End Sub

I have this, but i dont know how to put to change depending of the size of each page
  • After hours searching I finally made it myself

    Sub RectToPaperSimple()
    Dim p As Page, s As Shape, sr As ShapeRange
    Dim i&

    For i = 1 To ActiveDocument.Pages.Count
    With ActiveLayer.Page
    ActiveLayer.CreateRectangle .LeftX, .TopY, .RightX, .BottomY
    End With
    Next i
    End Sub