So we have a client here that wants 150 stickers all with unique numbers on them, from 600-750.
Is there a way to automate this process without having to create new pages and edit each number/ text on each page one by one?
Here's the graphic incase that matters:
Hello, everybody!
The fact is that this problem remains as relevant as it was 13 years ago. Especially for people working with older versions of CorelDraw. With the newer ones, I don't know if the topic has developed and if Mail merge has achieved the ease and intuitiveness of that of MS Word, MS Excel.
In older versions, VBA allows this gap to be filled. Because of the above, I am taking the liberty of offering a code for numbering coupons, tickets, coupons, etc. again. I am offering a modified code that is based on an older one of mine, but in this case it only numbers in one place on the coupon. This is the easier task. I can confidently say that VBA makes it possible to realize almost any user fantasy. I hope this code is useful for you. The code is not perfect and can be improved. Any suggestions or ideas would be gratefully received. The code will be especially useful for people interested in VBA and CorelDRAW's Document Object Model. For it to work, two of the coupons need to be located at the top of the first sheet next to each other. Each coupon has 0000 /Null Null Null Null/ entered, indicating where the automatic numbering will be located. After selecting the two coupons together with their numbers, the program starts. Somewhere in the beginning there is a MsgBox "Resume" that overcomes an unexpected error. Without the MsgBox "Resume" the program does not perform the task as expected. This is in Corel X5.
'TO WORK THIS CODE MUST:'HAVE 2 TICKETS ON PAGE 1 NEAR AT TOP MARGIN
'EVERY TICKET MUST HAVE 1 NUM FIELDS / NUMERIC TEXT'THE TICKETS MUST BE SELECTED
'LOCKED OBJECT CAN NOT BE DUPLICATED'IF LAYER IS LOCKED FOR EDITING - IT CAN'IF LAYER IS LOCKED CAN NOT SELECT OBJECTS ON ITActiveSelection.Shapes.All.GroupPAGES_COUNT = ActiveDocument.Pages.CountIf ActiveDocument.Pages.Count > 1 ThenFor X = 2 To PAGES_COUNTActiveDocument.Pages(2).DeleteNextEnd IfDim AAA, BBB As ShapeActiveDocument.Pages(1).Shapes(1).MoveToLayer ActiveDocument.Pages(1).Layers("Layer 1")Set AAA = ActiveDocument.ActivePage.Layers("Layer 1").Shapes(1).Duplicate(0, -ActiveDocument.ActivePage.Layers("Layer 1").Shapes(1).SizeHeight)
For X = 1 To 2Set AAA = AAA.Duplicate(0, -AAA.SizeHeight) 'not work if lockedNext
With ActiveDocument.Pages(1).Shapes.All.Group.CopyEnd With
ActiveDocument.Pages(1).Shapes(1).MoveToLayer ActiveDocument.Pages(1).Layers("Layer 1")ActiveDocument.BeginCommandGroup "DELETE PAGES 2-5"PAGE_COUNT = ActiveDocument.Pages.CountIf ActiveDocument.Pages.Count > 1 ThenFor X = 2 To PAGES_COUNTActiveDocument.Pages(2).DeleteNextEnd IfActiveDocument.EndCommandGrouptbTicketsTotal = 150tbTicketsOnPage = 8pages_tocreate = tbTicketsTotal / tbTicketsOnPageActiveDocument.AddPages (pages_tocreate - 1)
For X = 2 To ActiveDocument.Pages.CountWith ActiveDocument.Pages(X).Activate.Layers("Layer 1").PasteEnd WithNextMsgBox "RESUME"
''paste on each pageFor X = 2 To ActiveDocument.Pages.CountActiveDocument.Pages(X).Layers("Layer 1").PasteNext
'ungroup allDim MPAGE As PageFor Each MPAGE In ActiveDocument.PagesMPAGE.Shapes.All.UngroupAllNext
'numberingDim DSHAPE As ShapeDim DPAGE As Page
tbStart=600
FLAG1 = tbStart - 1FLAG3 = 0
For Each DPAGE In ActiveDocument.Pages
For Each DSHAPE In DPAGE.Shapes
If DSHAPE.Type = 6 Then 'textFLAG1 = FLAG1 + 1VCENTERX = DSHAPE.CenterXVCENTERY = DSHAPE.CenterY
tbNumPosition = 4For X = 1 To tbNumPositionzerostring = zerostring & "0"NextIf tbNumPosition = 1 ThenDSHAPE.Text.Range(0, 1000) = Format(FLAG1, "0")End IfIf tbNumPosition = 2 ThenDSHAPE.Text.Range(0, 1000) = Format(FLAG1, "00")End IfIf tbNumPosition = 3 ThenDSHAPE.Text.Range(0, 1000) = Format(FLAG1, "000")End IfIf tbNumPosition = 4 ThenDSHAPE.Text.Range(0, 1000) = Format(FLAG1, "0000")End IfIf tbNumPosition = 5 ThenDSHAPE.Text.Range(0, 1000) = Format(FLAG1, "00000")End If
tbSize = 20DSHAPE.Text.Range(0, 100).Size = tbSize
DSHAPE.CenterX = VCENTERXDSHAPE.CenterY = VCENTERYEnd IfNextNext
End Sub
Final result: