Hello,
I have a problem with placing text with vba at different text height and with values. The follwoing code snipset works well in MS V8i SS10 but in CONNECT I have no idea what ist going wrong.
Sub test() Dim TextElement As TextElement Dim Point As Point3d Point.X = 100 Point.Y = 100 Set TextElement = CreateTextElement1(Nothing, "my text", Point, Matrix3dIdentity) TextElement.Color = 6 TextElement.TextStyle.Height = 5 TextElement.TextStyle.Width = 5 Application.ActiveModelReference.AddElement TextElement TextElement.Redraw msdDrawingModeNormal End Sub
If I change the TextElement.TextStyle.Height or Width value the text will be placed at the same values as before.
best regards
Daniel
Daniel Grohmann said:The following code works well in MS V8i SS10 but in CONNECT I have no idea what is going wrong
Adopt Jan's advice and suggestions.
Daniel Grohmann said:TextElement.TextStyle.Height = 5
TextElement.TextStyle.Height = 5
That statement creates a temporary TextStyle variable and assigns its height to 5. The temporary variable is subsequently destroyed and your TextElement is unaffected.
TextStyle
TextElement
This article tells you more about VBA and Text Styles.
Regards, Jon Summers LA Solutions