Hi people !
I have always the problem when I have to make some tickets with serial number on it.
I use some software for that job, but I don't like it. I prefer to work in CDR. I know that there are some scripts for numbering directly in Corel, but I'm not familiar with it.
What do you suggest ? What's the procedure ?
Thank you !
Hello everyone!
This is an old discussion, but this problem is still relevant today, especially with the older versions - X3, X5
For this reason, I propose an entirely VBA solution. Better, faster code can certainly be written. This is code written in haste, without optimization.
I offer a working idea.
For the code to work, there must be one ticket on Page 1 near the top. There must be 3 numbers on the ticket, in the positions where we want the consecutive numbers to be printed.Before running the code, the ticket must be selected, along with the numbers on it.If the code is run from a form, fields can be made: number of tickets, starting number of generation, font size, number of numerical positions in the generated number, etc.For convenience, all these quantities are now set in the code.
Private Sub tbGenerate()‘tb means text boxes in user formtbTicketsTotal = 20tbTicketsOnPage = 4tbNumPosition = 4tbSize = 20'TO WORK THIS CODE MUST:'HAVE ONLY coONE TICKET ON PAGE 1 NEAR AT TOP MARGIN'THIS TICKET MUST HAVE 3 NUMERIC FIELDS / NUMERIC TEXT'THE TICKET MUST BE SELECTED ActiveSelection.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)NextActiveDocument.Pages(1).Shapes.All.GroupActiveDocument.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.EndCommandGroup pages_tocreate = tbTicketsTotal / tbTicketsOnPageActivePage.Shapes(1).CopyActiveDocument.AddPages (pages_tocreate - 1)For X = 2 To ActiveDocument.Pages.CountActiveDocument.Pages(1).Shapes.All.CopyActiveDocument.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 FLAG1 = 1FLAG3 = 0 For Each DPAGE In ActiveDocument.Pages For Each DSHAPE In DPAGE.Shapes If DSHAPE.Type = 6 Then 'textFLAG3 = FLAG3 + 1 If FLAG3 > 3 Then FLAG1 = FLAG1 + 1 FLAG3 = 1End IfVCENTERX = DSHAPE.CenterXVCENTERY = DSHAPE.CenterYFor 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 IfDSHAPE.Text.Range(0, 100).Size = tbSizeDSHAPE.CenterX = VCENTERXDSHAPE.CenterY = VCENTERYEnd IfNextNextEnd Sub Greetings!