Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I Un-center the Title Bar text? Charles Excel Discussion (Misc queries) 1 October 27th 09 02:09 PM
HOW DO I CENTER TEXT WITHIN A CELL? minnie112685 New Users to Excel 1 July 5th 09 06:29 PM
center text Gary''s Student Excel Discussion (Misc queries) 2 May 5th 07 06:26 PM
Center text in dialog box Raza Excel Worksheet Functions 1 December 5th 05 08:34 PM
How to center text in a msgbox Dave_2k5[_3_] Excel Programming 2 July 26th 05 02:31 PM


All times are GMT +1. The time now is 04:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"