View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default 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