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 19-02-2009, 01:32
Joe Joe is offline
Member
 
Join Date: Nov 2008
Location: Latvia
Posts: 92
Send a message via Skype™ to Joe
Default Changing selection when two-shape group loses one shape

Hello again!

Have a somewhat specific problem here - Say I have done certain actions and grouped together two objects - one is the base shape and the other is the result of macros actions, named, say "ResultShape".

If I then simply want to remove the ResultShape it's as easy as

Code:
ActiveSelectionRange.Shapes.FindShapes("ResultShape").Delete
After this is done the active selection jumps to the remaining shapes in the group (the base shapes) and the group object gets dissolved AFAIU. Now this is where the problems come in - if I need to work on a range of shapes, some of them being groups which need the removal of the "ResultShape", others being plain shapes which need to be processed. A problem occurs if I do something like:

Code:
ChangeRange.AddRange ActiveSelectionRange

ChangeRange.Shapes.FindShapes("ResultShape").Delete

For Each CurrentShape In ChangeRange
' Do something with the CurrentShape and an
' error occurs stating that the referenced shape (the group, I guess)
' no longer exists
The group is also named, say "ResultShapeGroup", but if I try to remove that from the selection then the base shapes which need processing also get removed.

Any ideas?
Reply With Quote
  #2  
Old 19-02-2009, 02:50
Joe Joe is offline
Member
 
Join Date: Nov 2008
Location: Latvia
Posts: 92
Send a message via Skype™ to Joe
Default

Looks like it's a good idea to eat something in the morning so the brain gets some energy. Came up with a (somewhat ham-fisted?) solution myself:

Code:
'Find ALL the shapes (including the parent group AND its subshapes
CurrentRange.AddRange ActiveSelectionRange.Shapes.FindShapes()
'Remove the unnecessary shapes
ActiveSelectionRange.Shapes.FindShapes("JTShadow").Delete
'CorelDraw neatly takes care of the rest and we get a clean new seleciton
CurrentRange.CreateSelection
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
Replace shape with another shape dungbtl CorelDRAW/Corel DESIGNER VBA 24 28-12-2019 04:56
a shape on top of another Seelenquell CorelDRAW/Corel DESIGNER VBA 15 01-03-2008 08:08
Get Shape Index ID Value m31uk3 CorelDRAW/Corel DESIGNER VBA 6 08-02-2008 18:50
Symbol shape is not found in a group squonk CorelDRAW/Corel DESIGNER VBA 1 14-06-2007 06:32
How to select all shape ? -=HKLC=- CorelDRAW/Corel DESIGNER VBA 1 25-10-2004 00:10


All times are GMT -5. The time now is 23:30.


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