Help getting a macro to run through all pages in the document

I have created this simple macro on X6 that will move everything in the page to the right side outside the page. I have no knowledge coding but I need to change it in order to run through all the pages selecting and moving everything in each page to the right side outside the page and stacking evrything vertically. Page size will always be 24 x 18 inches.

I will really appreciate it if I could get some help with this. I have to do this almost everyday for laser engraving files with many pages. It will be a real time saver if I could automate this task.

Thank you in advance and this is the macro created but working only in one page. 

Sub Macro1()
' Recorded 1/20/2023
ActivePage.Shapes.All.CreateSelection
ActiveSelection.Move 26, 0#
End Sub

Parents Reply
  • Also, other than the first page, I only see the obects moved if I change pages manually.

    Ah, OK, I was not considering that you were also having CorelDRAW automagically move shapes to the Desktop layer when they are moved outside the page boundary.

    You could try this one, which "stacks" the moved content vertically, and also walks through the document, activating each page, which should trigger the move-to-Desktop:

    Sub move_things()
    Dim pThis As Page
    Dim srThis As ShapeRange
    Dim dblLastBottomY As Double
    Const dblVertSpacing As Double = 1
    
        For Each pThis In ActiveDocument.Pages
            Set srThis = pThis.Shapes.All
            srThis.Move 26, 0
            If pThis.Index > 1 Then
                srThis.TopY = dblLastBottomY - dblVertSpacing
            End If
            dblLastBottomY = srThis.BottomY
        Next pThis
        
        For Each pThis In ActiveDocument.Pages
            pThis.Activate
        Next pThis
        ActiveDocument.Pages.First.Activate
    End Sub
    
Children