OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > Macros/Add-ons

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-08-2010, 09:42
ajesion
Guest
 
Posts: n/a
Default Numbering objects

Thanks to your forum I wrote following code:
Code:
Sub NR()
        ActiveDocument.BeginCommandGroup "nr: w 1,2,3…"
    Dim s As Shape
    Dim sr As ShapeRange
    Dim n As Long
    Set s = ActivePage.TextFind("nr:", True)
    Set sr = ActiveSelectionRange
        n = 1
    For Each s In sr
        s.Text.Story = n
        n = n + 1
    Next s
        ActiveDocument.EndCommandGroup
End Sub
Is there any way to work that code on all pages in active document?
Reply With Quote
  #2  
Old 12-08-2010, 11:25
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default ActiveSelection

Quick question, the current code looks at the ActiveSelection, if you go to multiple pages, you would no longer want to search only in the ActiveSelection. After all, it is only on your current page. Correct?

-Shelby
Reply With Quote
  #3  
Old 12-08-2010, 11:33
ajesion
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by shelbym View Post
Quick question, the current code looks at the ActiveSelection, if you go to multiple pages, you would no longer want to search only in the ActiveSelection. After all, it is only on your current page. Correct?

-Shelby
Yes, it's only works on active page, and I don't know how to change that code for "all pages".
Reply With Quote
  #4  
Old 12-08-2010, 11:38
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
I modified it a little. I wasn't exactly sure of the end result needed.
Maybe this can help:

Code:
Sub renameAll()

Dim s As Shape, sr As ShapeRange, p As Page
Dim n As Long, oldStr As String

n = 1

For Each p In ActiveDocument.Pages
    p.Activate
    Set sr = ActivePage.FindShapes(, cdrTextShape)
    For Each s In sr
        oldStr = s.Text.Story.Characters.All
        If VBA.InStr(oldStr, "nr:") Then
            
            s.Text.Story.Characters.All = oldStr & "_" & n
            n = n + 1
        End If
    Next s
Next p

End Sub
-John

Last edited by runflacruiser; 12-08-2010 at 11:51. Reason: spelling
Reply With Quote
  #5  
Old 12-08-2010, 12:04
ajesion
Guest
 
Posts: n/a
Default

Very Thank you. It works. And another request: a result of, for example, are now 24, 23, 22 ..., as it reversed.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Numbering Hernán New product ideas 3 15-02-2007 22:12
Numbering for Tickets Whaler New product ideas 4 15-02-2007 22:11
subpath numbering lkoky CorelDRAW/Corel DESIGNER VBA 2 02-11-2004 02:37
Numbering and Printing dean29673 Code Critique 2 12-07-2004 16:07
Page Numbering Hernán CorelDRAW/Corel DESIGNER VBA 3 11-06-2004 02:25


All times are GMT -5. The time now is 18:29.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com