![]() |
#1
|
|||
|
|||
![]()
Hi.
I'm pretty new to Corels VBA (but not this in general) and have a question. I want a macro to take the currently selected object and copy it X times at Y spacing (easy) but also to increment a number in its text field (hard). In this instance, it is a circle with an embedded text field, which contains a number '1' centred horizontally and vertically. I want the macro to create the next ones in sequence, used for ballooning of items etc. It seems I can't record editing of text in the macro 'Recording of this command is not supported' Any help appreciated Rich |
#2
|
||||
|
||||
![]()
Here is something for you to start with:
Code:
Sub DuplicateTextInsideShape() Dim srDup As ShapeRange Dim s As Shape Dim nVal As Long ' Duplicate the selection first Set srDup = ActiveSelectionRange.Duplicate(4, 0) ' Find if there is a text in the duplicate, and if it contains a number, increment it For Each s In srDup If s.Type = cdrTextShape Then ' If the text is inside another shape If s.Text.Frame.IsInsideContainer Then ' If the text block is not empty If Trim$(s.Text.Story) <> "" Then ' Get the current numeric value of the text nVal = Val(s.Text.Story) ' Increment the value nVal = nVal + 1 ' Set it back to the text s.Text.Story = CStr(nVal) End If End If End If Next s End Sub |
#3
|
|||
|
|||
![]()
Wow! Thanks Alex. That is exactly what I need.
Very much appreciated! thanks again Rich |
![]() |
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 |
Text selection problem | ken_ac | CorelDRAW/Corel DESIGNER VBA | 2 | 10-02-2004 20:24 |