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 15-12-2008, 12:57
bprice's Avatar
bprice bprice is offline
Member
 
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default group check

i can't seem to get my head where it needs to be today...

how do i tell if my currently selected objects are grouped?

if my "selection" is all grouped, i want my script to continue... if there is no groups found in my selection, I want it to msgbox an error...

i'm sure this is something silly and easy... but i just can't seem to get in gear today!

thanks in advance!

B
Reply With Quote
  #2  
Old 16-12-2008, 08:09
Manuel
Guest
 
Posts: n/a
Default

I guess it would be something like this:

Code:
If ActiveSelection.Type = cdrGroupShape Then
or

Code:
Dim sr as New ShapeRange
Set sr = ActiveSelectionRange.Shapes.FindShapes(Type:=cdrGroupShape)
If sr.Count <> 0 Then

Last edited by Manuel; 16-12-2008 at 08:18.
Reply With Quote
  #3  
Old 16-12-2008, 08:17
bprice's Avatar
bprice bprice is offline
Member
 
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default yes but... hahaha

thats what i thought too... but it doesn't work! hence the reason I think I'm going nuts!

Shouldn't this work?

Code:
Sub GroupTest()
Dim S As Shape

Set S = ActiveSelection

    If S.Type = cdrGroupShape Then
        S.UngroupAllEx
    Else
        MsgBox "No Group"
    End If

End Sub

Last edited by bprice; 16-12-2008 at 09:40. Reason: added code
Reply With Quote
  #4  
Old 16-12-2008, 12:34
Manuel
Guest
 
Posts: n/a
Default

This works...
Code:
Sub GroupTest()
Dim S As Shape

Set S = ActiveShape

    If S.Type = cdrGroupShape Then
    S.UngroupAllEx
    Else
        MsgBox "No Group"
    End If
Reply With Quote
  #5  
Old 16-12-2008, 12:43
bprice's Avatar
bprice bprice is offline
Member
 
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default

Excellent! That worked! Thanks muchly!
Reply With Quote
  #6  
Old 16-12-2008, 15:41
bprice's Avatar
bprice bprice is offline
Member
 
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default but wait... there's more! hahaha

i need to throw in a little twist here! what if my "activeshape" has 3 boxes in it... 2 of those boxes are grouped... 1 is not!

Technically the whole object/shape/selection is not a group (even though part of it is)... so it should continue on as if it's NOT a group shouldn't it?

since part of it is a group... it sees the entire things as a group when in fact it isn't...

why would this be?

I guess an example of where I am going would be this....

If I have a bunch of objects selected... and if ANY of the selected objects are NOT in one group... I want it to warn me telling me "some or all of the selected objects are not part of a group" before continuing!

Last edited by bprice; 16-12-2008 at 15:49. Reason: added example
Reply With Quote
  #7  
Old 16-12-2008, 18:30
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,790
Blog Entries: 13
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 Groups Groups Groups

Here is what I came up with.
Code:
Sub ShapeNotInGroup()
    Dim s As Shape
    Dim intCount As Integer
    
    intCount = 0
    
    For Each s In ActiveSelection.Shapes
        If s.Type <> cdrGroupShape Then intCount = intCount + 1
    Next s
    
    If intCount = 1 Then
        MsgBox "There is 1 shape not in a group."
    ElseIf intCount > 1 Then
        MsgBox "There are " & intCount & " shapes not in a group."
    End If
End Sub
Hope it 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
Find Group ungroup it then process and again group derasje Macros/Add-ons 2 19-11-2008 05:04
Folder Check norbert_ds CorelDRAW/Corel DESIGNER VBA 2 13-01-2008 21:18
Please someone check this! knowbodynow CorelDRAW/Corel DESIGNER VBA 9 31-03-2006 19:46
How to Check for two keys pressed at the same time xombie CorelDRAW/Corel DESIGNER VBA 2 09-12-2005 10:29
How to check presence effects? G-Kir CorelDRAW/Corel DESIGNER VBA 3 22-06-2005 07:11


All times are GMT -5. The time now is 10:49.


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