Center Text on Point
I'm using a macro to drawing lines and then adding text labels to the lines.
The text has variable lengths. Right now I'm adding the text so that the left top of the text box corresponds to the 1/2 point of the line. How can I center theh text on a specific point (for example the 1/2 way point on a line)? -- Richard |
Center Text on Point
Maybe something like this
Sub test2() Dim ctrHz As Double, ctrVt As Double With ActiveSheet.Shapes("Line 1") ctrHz = .Left + .Width / 2 ctrVt = .Top + .Height / 2 End With With ActiveSheet.Shapes("Text Box 2") .Left = ctrHz - .Width / 2 .Top = ctrVt - .Height / 2 End With End Sub You might want to format your textbox's Autosize property = true Regards, Peter T "Richard" wrote in message ... I'm using a macro to drawing lines and then adding text labels to the lines. The text has variable lengths. Right now I'm adding the text so that the left top of the text box corresponds to the 1/2 point of the line. How can I center theh text on a specific point (for example the 1/2 way point on a line)? -- Richard |
All times are GMT +1. The time now is 12:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com