OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-07-2008, 12:36
bprice's Avatar
bprice bprice is offline
Member
 
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default Change Page Names

Hello again everyone,

If I have a multiple page document, I need pages to be named a certain way. I have two types of drawings I do. Presentation Drawings & Production Drawings. As part of an existing script, I’d like to add a drop down box for renaming my page names.

For example, if I select “Presentation Drawing” from the drop down, on page 1 of my document, and click my “o.k.” button, It’ll change the page name to “Presentation Drawing”. Simple enough, I can achieve this at this point.

However, if I then add a new page in my document, and select “Presentation Drawing” from my list and hit o.k., it names the second page “Presentation Drawing”… which of course is what it would naturally do!

BUT… what I would like it to do is call it “Presentation Drawing 1”! Now, if I add another page in the same document and select “Presentation Drawings” from the list, it’ll automatically “search” the document for page names and it would obviously call the next “Presentation Drawing 2”. So on and so on throughout the document…

Is this easily achievable, or am I asking for the impossible again? Hahaha

Any help is always appreciated!

Thanks,
B
Reply With Quote
  #2  
Old 02-07-2008, 13:44
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 Call me Lazy....

Yea so I am a bit lazy today....so take this as the lazy man's out. :-) I would create two Subs, one that adds a page and then calls a second Sub to just rename the pages. That way you can use the same renaming sub to rename any of your current document. How is that for lazy. And you don't have to worry about trying to find you last page and all that.

This sub adds a new page and calls the renaming sub:
Code:
Sub AddNewPage()
    ActiveDocument.AddPages 1
    RenamePages
End Sub
This sub renames all the pages per your specs:
Code:
Sub RenamePages()
    Dim p As Page
    
    For Each p In ActiveDocument.Pages
        If p.Index = 1 Then
            p.Name = "PresentationDrawings"
        Else
            p.Name = "PresentationDrawing " & p.Index - 1
        End If
    Next p
End Sub
Now you will just have to modify it a bit to work with your dialog. Man I am lazy today!

-Shelby
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
Duplicating original page for multi-page layout psypha General 1 06-08-2007 14:05
replacing page names knowbodynow CorelDRAW/Corel DESIGNER VBA 8 25-04-2007 17:01
Group Names? knowbodynow CorelDRAW/Corel DESIGNER VBA 1 03-04-2007 08:15
Bitmap names in Corel 12... meandirtyjoe CorelDRAW/Corel DESIGNER VBA 1 17-05-2005 09:14
Function names Lev Oberon Function Plotter 1 29-08-2003 11:04


All times are GMT -5. The time now is 04:46.


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