![]() |
#1
|
|||
|
|||
![]()
I need some kind of VBA code allowing creation of a counter that can create an array of selected object where every number increase by a specific step.
For exaple i have some kind of badge with a serial number on its bottom, i need a script to create hundrends of copies of the same badge with serialization. Any help ? Thank you |
#2
|
|||
|
|||
![]()
I've got the same problem, but i haven't heard anything yet. I 'think' Coreldraw doesn't recognize numbers as numbers but as just another object. Not sure if that's true or not but would be interested in knowing.
cutter |
#3
|
||||
|
||||
![]()
Have you tried using CorelDRAW's Print Merge feature? It can do just that but when printing. If you need to create a document with all your badges in it, you will either have to create a macro or use something like Name Drop Express.
If you are going with your own macro, generally what you need to do is to identify your text object which will contain the number (you can give it a special name or place a special text string in it). Then just duplicate the selected objects, go through every object in selection and find your text shape. Replace its text string with the current number. Finally increment the counter, and proceed to the duplicated objects and repeat the operations. |
#4
|
|||
|
|||
![]()
Thank you Alex and Cutter.
I'm gona write my own script for such a function because is something i really need. |
#5
|
|||
|
|||
![]()
Hello.
Alex.. my question to you.. if its possible to create that Calendar wizard.. how do we make thing like A rectangle, text in it like 00001 and the automatic duplication of this rectangle with text enumeration till like let's say 00800. If i get things right.. it ain't immpossible.. Thank you in advance because the numbers I must create end far not with 800... ![]() |
#6
|
||||
|
||||
![]() Quote:
![]() Here is the sample code. Just create a few objects with an artistic text object. Give the artistic text object a name "Number" (in Object Manager or in Object Data Manager docker). Then select all the objects and run the macro. It will create 100 copies and number all of them consecutively. It will create no more than 32 copies per page ( 4 x 8 ). Code:
Sub NumberAndDuplicate() Const NumX As Long = 4 ' Number of copies horizontally Const NumY As Long = 8 ' Number of copies vertically Const DupCount As Long = 100 ' Total number of copies Dim sr As ShapeRange Dim nx As Long, ny As Long Dim n As Long nx = 0 ny = 0 Set sr = ActiveSelectionRange ActiveDocument.ReferencePoint = cdrTopLeft For n = 1 To DupCount PlaceObjects sr, n, nx, ny If n <> DupCount Then Set sr = sr.Duplicate(20, 20) ' To make sure that the copy is on the desktop End If nx = nx + 1 If nx >= NumX Then nx = 0 ny = ny + 1 If ny >= NumY Then ny = 0 ActiveDocument.AddPages 1 End If End If Next n End Sub Private Sub PlaceObjects(ByVal sr As ShapeRange, ByVal n As Long, ByVal nx As Long, ByVal ny As Long) Const PageMargin As Double = 0.5 ' Page Margin = 0.5" Const Spacing As Double = 0.2 ' Object Spacing, 0.2" Dim s As Shape Dim x As Double, y As Double sr.CreateSelection x = PageMargin + nx * (sr.SizeWidth + Spacing) y = ActivePage.SizeHeight - PageMargin - ny * (sr.SizeHeight + Spacing) ActiveSelection.SetPosition x, y Set s = ActiveSelection.Shapes.FindShape("Number", cdrTextShape) If Not s Is Nothing Then s.Text.Story = Format$(n, "000000") ' Format the serial number End If End Sub |
#7
|
|||
|
|||
![]()
well i made it .. pasted it as is.
on F5 i get syntax error.. (6) Error: Syntax error at symbol "SHAPERANGE". (12) Error: Syntax error at symbol "SR". (13) Fatal error: Dialog or dialog control not specified. 3 error(s), 0 warning(s). I'm using Corel 9 I'm a newbie to all this so forgive me my failures... |
#8
|
|||
|
|||
![]()
I'm going trough all the manual for scripting.. and it didn't even find the type "ShapeRange"..
Is there a substitute i can use? |
#9
|
||||
|
||||
![]() Quote:
|
#10
|
|||
|
|||
![]()
aha
I'll see what's up =] DS |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
fit objects to path edges | geopig | Other Oberon Commercial Products | 1 | 02-08-2006 23:28 |
Find objects by properties | Webster | CorelDRAW/Corel DESIGNER VBA | 8 | 01-12-2004 18:51 |
Letter and Number Counter | ddonnahoe | CorelDRAW/Corel DESIGNER VBA | 5 | 05-11-2004 13:27 |
Need help accessing objects in a group | ama | CorelDRAW/Corel DESIGNER VBA | 5 | 20-02-2004 11:28 |
I need to update objects visibility faster | NEHovis | Corel Photo-Paint VBA | 0 | 18-07-2003 07:54 |