![]() |
#1
|
|||
|
|||
![]()
For example, I have two selected any shapes.
Code:
Sub test() Dim s as shape Set s=ActiveShape ActiveDocument.ClearSelection 'How to know count of the shapes in 's'? End Sub Last edited by ager; 08-05-2018 at 04:50. |
#2
|
|||
|
|||
![]()
Sorry I don't understand the question. If you have used ActiveDoucment,ClearSelection then the shape count should be 0.
Code:
Sub count() MsgBox ActiveSelection.Shapes.count End Sub Code:
Sub CountSelectedShapes() Dim s As Shape Dim n As Double If ActiveSelection.Shapes.count > 0 Then Set s = ActiveSelection.Duplicate s.UngroupAll n = s.Shapes.count s.Delete MsgBox "The number of shapes is: " & n, vbInformation, "Active Selection Count" Else MsgBox "Please select some shapes.", vbExclamation, "Oops!" End If End Sub Last edited by knowbodynow; 11-05-2018 at 19:48. |
#3
|
|||
|
|||
![]()
No, the object "s" continues to exist. I do not delete it. So, the question is how to determine how many shapes are contained in the object "s".
|
#4
|
|||
|
|||
![]()
use ActiveSelectionRange
Code:
Sub test() Dim sr as ShapeRange Set sr = ActiveSelectionRange ActiveDocument.ClearSelection MsgBox sr.Count End Sub |
#5
|
|||
|
|||
![]()
Thanks for the answers. But my function works with objects which type is "Shape", not "ShapeRange". As I understand, the object "Shape" can not give the information about number of shapes it really contains.
I discovered that object "Shape" can contain only one shape. If we have two (or more) selected shapes and execute this code, only one shape will be copied and pasted: Code:
Sub test() Dim s as Shape Set s=ActiveShape ActiveDocument.Copy ActiveDocument.ClearSelection ActiveLayer.Paste End Sub Last edited by ager; 17-05-2018 at 22:29. |
#6
|
|||
|
|||
![]() Quote:
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Count shapes on Pritable are | gebp | CorelDRAW/Corel DESIGNER VBA | 3 | 31-10-2011 20:02 |
X5 Documents.Count error | knowbodynow | CorelDRAW/Corel DESIGNER VBA | 1 | 04-05-2010 23:30 |
count colors in PP | Jeff Harrison | Corel Photo-Paint VBA | 0 | 17-12-2008 03:38 |
PP12 tools count = 0 | Michael Cervantes | Corel Photo-Paint VBA | 0 | 30-05-2004 00:09 |
looping until documents.count = 0 | bbolte | CorelDRAW/Corel DESIGNER VBA | 18 | 18-02-2003 16:03 |