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 01-08-2012, 10:59
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default FindShapes & PowerClips

I am working in X6. I have a rectangle shape that I am using as a powerclip frame. Within the powerclip is an artistic text shape named "example". Currently the font for the text is Arial, but I want to change it via VBA. I have tried to use
Code:
Set s = ActiveLayer.FindShape("example")
but the macro does not seem to dig into the powerclip. How can I make FindShape work within powerclips?
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #2  
Old 01-08-2012, 16:45
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,791
Blog Entries: 15
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 FindShape

FindShape or FindShapes will dig into groups but no powerclips, if you want to dig into powerclips you will need to make your own function. Here is a version of mine:
Code:
Function FindAllShapes() As ShapeRange
    Dim s As Shape
    Dim srPowerClipped As New ShapeRange
    Dim sr As ShapeRange, srAll As New ShapeRange
    
    If ActiveSelection.Shapes.Count > 0 Then
        Set sr = ActiveSelection.Shapes.FindShapes()
    Else
        Set sr = ActivePage.Shapes.FindShapes()
    End If
    
    Do
        For Each s In sr.Shapes.FindShapes(Query:="!@com.powerclip.IsNull")
            srPowerClipped.AddRange s.PowerClip.Shapes.FindShapes()
        Next s
        
        srAll.AddRange sr
        sr.RemoveAll
        sr.AddRange srPowerClipped
        srPowerClipped.RemoveAll
    Loop Until sr.Count = 0
    
    Set FindAllShapes = srAll
End Function
So if you needed to find a shape by name you could do this:
Code:
Sub FindByName()
    Dim s As Shape
    
    Set s = FindAllShapes.Shapes.FindShape("Example")
    s.Fill.UniformColor.CMYKAssign 0, 0, 100, 0
End Sub
Hope that helps,

-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
Extract Multiple Powerclips dungbtl CorelDRAW/Corel DESIGNER VBA 2 15-04-2007 10:06
FindShapes Selection irregularity Shaddy CorelDRAW/Corel DESIGNER VBA 2 18-07-2006 20:41
[VBA] FindShapes reduced behaviour in X3 ;-( wOxxOm CorelDRAW/Corel DESIGNER VBA 0 05-06-2006 10:50


All times are GMT -5. The time now is 01:41.


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