Hello to all.
I'm trying to make CorelDRAW show me a list of the shapes selected, giving me width, height, quantity of each shape, and an ID number, among other things.
I'm using the code below, which I found online, but I cannot seem to find it again, so sorry for the lack of proper credits.
Problems are:
First, it gives me the static ID of each shape. I would like it to just count each shape and list it to me in crescent order (1, 2, 3...), because I have to enter this information in a software that demands an ID to be in crescent order. It can also be the static ID (I have no use for that number, but the software asks for it), as long as it's listed in crescrent order.
Second, if possible, I would like it to give me the quantity of identical shapes. Right now, if I select two or more identical shapes, it just lists the same thing twice or more. But the software I'm using doesn't accept repetitions on this list. It's fine if that's not possible, because I can just select one of each shape, but it would make my life easier.
Infos such as "CodMat", "Description" and "Obs" are 0 or 1 as default because I don't need them, but the software asks for them. Those can be repeated, though.
Dim txt As StringPrivate Sub CommandButton1_Click() Dim s As Shape ActiveDocument.Unit = cdrMillimeter TextBox1.Value = "Cod." + vbTab + "Qtt" + vbTab + "Width" + vbTab + _ "Height" + vbTab + "CodMat" + vbTab + "Description" + vbTab + "Obs." + vbLf
For Each s In ActiveSelection.Shapes Next s For Each s In ActiveDocument.SelectionRange describeCircle s Next s txt = TextBox1.Value End Sub
Sub describeCircle(s As Shape) txt = "" 'inclusion of item code and quantity txt = txt + Trim(Str(s.StaticID)) + vbTab + "1" 'addition of width and height txt = txt + vbTab + Trim(Str(Round(s.SizeWidth, 3))) + vbTab + _ Trim(Str(Round(s.SizeHeight, 3))) 'addition of material code txt = txt + vbTab + "0" + vbTab + "0" + vbTab + "0" TextBox1.Value = TextBox1.Value + txt + vbLfEnd Sub
This is my first post here, so I apologize for any mistakes. Anyway, I would very much appreciate if anyone could take a look at this problem. Thanks in advance!