i've got a problem with a macro.
I have old cgm data with old callouts from another designer tool.
The old callouts are know divided into curves, ellipses and text. My goal is to transform it into a new callout.
So my idea is so get the coordinates from the text as the starting point and the coordinate from the ellipses as the the endpoint and make a new callout. The problem is, i can't get the coordinates from the text.
My macro looks like this at the moment:
Sub Macro1() ActiveDocument.Unit = cdrMillimeter Dim sh As Shape Dim shs As Shapes Dim s1 As Shape Dim s2 As Shape Dim OrigSelection As ShapeRange Set shs = ActiveSelection.Shapes()
With ActiveSelection.Ellipse Ex = .CenterX Ey = .CenterY End With With ActiveSelection.Text Tx = .CenterX Ty = .CenterY End With
MsgBox Tx For Each sh In shs.FindShapes(, cdrTextShape) Set s1 = ActiveLayer.CreateCustomShape("Callout", sh.Text.Story, 0, 0.07874, Array(Ex, Ey), Array(128.25, 53.74), 0#, Nothing, 0, 0, False) Set s2 = s1.Custom.TextShape Dim Callout1 As ShapeRange Set Callout1 = ActiveDocument.CreateShapeRangeFromArray(s2, s1) Callout1.SetOutlinePropertiesEx 0.013776, OutlineStyles(0), CreateRGBColor(0, 0, 0), ArrowHeads(90), ArrowHeads(0), cdrFalse, cdrFalse, cdrOutlineRoundLineCaps, cdrOutlineRoundLineJoin, 0#, 100, MiterLimit:=5#, Justification:=cdrOutlineJustificationMiddle Next sh End Sub
Maybe you have an idea.
What do you name „text coordinates”? Height, Width, CenterX, CenterY, text.Story, font, font size, Top, Left etc.?
I can see part of them in the code example...
Can you detail a little your last sentence which looks to you being important to be done?
Can you bring here the shape you try to reproduce?
If i choose the text i have four properties. 1 counted words. 2 selection size. 3 selection center. 4 pivot point.
For my macro i need the coordinates from the selection selection center.
The part with activeselection.text in my code was only a attempt to get these coordinates
On the picture, you can see the coordinates, i want to use.
I can only see them...
If I would understand them, it would be much better. Even if I know a little German... :-)
I will try a guess starting from your comment:
"counted words" means the number of words in the text? If yes then you can try: sh.Text.Story.Words.Count.
Where sh is the text shape to be analyzed...
"selection size" what does it mean? The size of selected shapes? if yes, try ActiveSelectionRange.SizeWidth and SizeHeight. If you have some selected tex inside the text.Story it is a little more complicate but, I think, not impossible... For instance, the next piece of code will select the first word of the text box: sh.Text.Story.Words.First.Select
"selection center" = ? If it is a matter of selection (selected shapes) center you can use: ActiveSelectionRange.CenterX, respectively, CenterY...
"pivot point" what should it be? The rotation center? If not, try do define it in some more words, to make a meaning...
Yes :D Pivot Piont is the rotation center. I can't change the programm language to english. Its blocked from my company :D
I get the coordinates, if i select the text in the object manager only. But for myy macro, i must select 5 or more shapes.
So it must be something like activeselection.findshapes.text........
But at that point i dont have something like CenterX or something else. It a little bit complicated :D
Maybe i try to explane what the macro should do.
I have a cgm file. This file contains an object an lots of callout. Its shown in the picture below.
But the callouts a splitted into lots of objects.
I want to select the object as shown in the picture,
Now, i need to coordinates. The Startpoint is the middel point of the text object.
The Endpoint ist the middle point of one of these ellipses.
If i have these coordinates, i can make a new callout.
How can i get these coordinates in an easy way?