PC Review


Reply
Thread Tools Rate Thread

Center Text on Point

 
 
Richard
Guest
Posts: n/a
 
      23rd Jun 2008
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 With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      23rd Jun 2008
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" <(E-Mail Removed)> wrote in message
news:AB834888-C593-4BCE-A6B8-(E-Mail Removed)...
> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
can window media center remote can run power point QuyNguyen Windows Vista General Discussion 0 6th Feb 2009 12:57 AM
text insertion point changed from vertical line to point, yuk. Dave Thomas Microsoft Word Document Management 2 17th Sep 2008 12:50 PM
how do I make an outline circle with a center point to put in powe =?Utf-8?B?YXRsaGRj?= Microsoft Powerpoint 2 9th Dec 2004 03:03 AM
How to find the center point of a donut or pie chart Belinda Microsoft Excel Charting 3 3rd May 2004 08:52 PM
yellow box with red exclamation point in the center Tammy Windows XP Internet Explorer 0 20th Nov 2003 04:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:12 PM.