CorelDraw & VBA
Summary & Introduction
Guide to CorelDraw VBA
Creating Variable Data
Variable Data From Access
Variable Data From Excel
Variable Data Without a Data File
CorelDraw BarCode Wizard
EAN13 BarCodes Without The Wizard
Code 39 BarCodes Without The Wizard
ITF-14 BarCodes Without The Wizard
Code 128 BarCodes Without The Wizard
QR BarCodes
Variable Pictures
Sorting for Guillotining
Repositioning Data
Pantone Colors
Saving VBA Code to a Previous Version of CorelDraw
Trim Marks
PhotoPaint
Miscellaneous VBA
Help
 
Repositioning Data

Often after placing variable data onto multiple pages, or if creating a book it is necessary to move all the data slightly either up or down, left or right.
CorelDraw does not have a move command that will move all objects on all pages by the same amount.
You can either re-run the macro to place the data again in a slightly different position or use this module - " Move".
In this revised Move file you can move all shapes on all pages and, if you wish, effectively keep the Master page shapes stationery.

Save the module and import it into into your code.
When you run the code input boxes will ask you by how much you wish to move all the objects on all the pages.
It will not move items on the Master Page.
Alternatively here is the code to copy and paste.


Sub MOVE_ALL_OBJECTS_ON_ALL_PAGES_EXCEPT_MASTER()
     'This procedure selects all shapes on all pages including the Master page.
     'It allows you to move them a specified distance.
     'It will ask if you wanted the shapes on the Mastepage moved.
     'If you did not then it moves the Master page shapes back.
     'This is easier than to select all shapes less the Master page shapes.

     'If you write a procedure to select all shapes on all pages.
     'Do not attempt to move the shapes using the mouse.
     'If you do, all the shapes, on all pages, will move to the active page.

     Dim ALL_SHAPES As ShapeRange
     Dim intPAGE_No As Integer
     Dim intNo_PAGES As Integer
     Dim strINPUTBOX_VALUE As String
     Dim sngX_POSITION As Single
     Dim sngY_POSITION As Single

     'Select All Shapes on All Pages.
     intNo_PAGES = ActiveDocument.Pages.Count
     Set ALL_SHAPES = ActiveDocument.Pages(1).Shapes.All
     intPAGE_No = 2
     While intPAGE_No <= intNo_PAGES
          ALL_SHAPES.AddRange ActiveDocument.Pages(intPAGE_No).Shapes.All
          intPAGE_No = intPAGE_No + 1
     Wend

     'Enter the horiziontal displacement.
     'If there is no input value then do not move across.
     strINPUTBOX_VALUE = InputBox("How many millimeters to the right?" & vbCr & "Negatives are OK.", _
       "Horizontal Displacement of All Objects!")
     If strINPUTBOX_VALUE = "" Then
          sngX_POSITION = 0
          Else
          'Convert string to single.
          sngX_POSITION = CSng(strINPUTBOX_VALUE)
     End If

     'Enter the vertical displacement.
     strINPUTBOX_VALUE = InputBox("How many millimeters up?" & vbCr & "Negatives are OK.", _
        "Vertical Displacement of All Objects!")
     'If there is no input value then do not move up.
     If strINPUTBOX_VALUE = "" Then
          sngY_POSITION = 0
          Else
          'Convert string to single.
          sngY_POSITION = CSng(strINPUTBOX_VALUE)
     End If

     'Measuremments are in inches so convert to millimeters and move all the objects.
     ALL_SHAPES.Move sngX_POSITION / 25.4, sngY_POSITION / 25.4

     Set ALL_SHAPES = Nothing

     'Ask if the Master Shapes were to be moved. If not move them back.
     If MsgBox("Move Master Shapes as well?", vbYesNo, "") = vbNo Then
          'Now select all the Master Shapes and return them to thir original position.
          Set ALL_SHAPES = ActiveDocument.MasterPage.Shapes.All
          'Measuremments are in inches so convert to millimeters and move all the objects.
          ALL_SHAPES.Move -1 * sngX_POSITION / 25.4, -1 * sngY_POSITION / 25.4

          Set ALL_SHAPES = Nothing
     End If

End Sub

2015_08_06