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 05-03-2018, 01:21
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default ObjectData from Page Names?

I want to rename objects from page names if the page name contains a space. Can anyone tell me why this isn't working:

Code:
Sub SetObjectNamesFromPageNames()
    
Dim p As Page
Dim s As Shape
    
    For Each p In ActiveDocument.Pages
        
        If InStr(p.name, " ") > 1 Then
 
            selectImagesLayer
            SelectAllImages
            
            Set s = ActiveSelection
            s.Group
            s.ObjectData("Name") = p.name
        End If
    
    Next p

End Sub
If I use virtually the same code and type in a name via a form then the group object does get an objectdata name assigned to it. What am I missing?
Reply With Quote
  #2  
Old 07-03-2018, 02:19
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146
Default try this

Code:
Sub SetObjectNamesFromPageNames()
    
Dim p As Page
Dim s As Shape
    
    For Each p In ActiveDocument.Pages
        
        If InStr(p.name, " ") > 1 Then
            set s = p.Shapes.FindShapes(, cdrBitmapShape).Group
            ' or s = p.Layers('your image layer').Shapes.FindShapes(, cdrBitmapShape).Group
            s.Name= p.name
        End If
    
    Next p

End Sub
Reply With Quote
  #3  
Old 07-03-2018, 19:05
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default Objectdata Name from Page Names?

Thanks but with that code I get an "Object variable or with block variable not set" error message for:

Code:
s.name = p.name
Reply With Quote
  #4  
Old 07-03-2018, 19:37
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default

Further investigation has revealed that there is a problem using p.name. if I put the page name into a string variable and use that it works. I suspect some bug with the version of X6 I am using (no service packs). Thanks for your help.
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
Copy page names to clipboard? knowbodynow CorelDRAW/Corel DESIGNER VBA 0 08-04-2014 09:54
Get page names from closed document knowbodynow CorelDRAW/Corel DESIGNER VBA 1 17-07-2010 00:38
Change Page Names bprice CorelDRAW/Corel DESIGNER VBA 1 02-07-2008 14:44
replacing page names knowbodynow CorelDRAW/Corel DESIGNER VBA 8 25-04-2007 18:01
ObjectData Fields shelbym CorelDRAW/Corel DESIGNER VBA 1 02-04-2004 08:19


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


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