Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I Un-center the Title Bar text? | Excel Discussion (Misc queries) | |||
HOW DO I CENTER TEXT WITHIN A CELL? | New Users to Excel | |||
center text | Excel Discussion (Misc queries) | |||
Center text in dialog box | Excel Worksheet Functions | |||
How to center text in a msgbox | Excel Programming |