Solved

Specify the top property of a text box added to a chart.

Posted on 2011-09-23
4
180 Views
Last Modified: 2012-05-12
Dear Experts:

Below code adds a textbox to the active chart.
 
activechart.Shapes.AddTextbox(msoTextOrientationHorizontal, 20, 120, 100 ,20).TextFrame.Characters.Text = "Hello"
'1. Value = Left property of textbox = 20 points
'2. Value = Top property of textbox = 120 points

I wonder whether it is possible to specify the ...
Top property of the textbox relative to the Height property of the active chart.

For example: I do not want to specify the Top Property as 120 points but as being  90% percent of the Height property of the active chart.

Is this possible?

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
0
Comment
Question by:AndreasHermle
  • 2
  • 2
4 Comments
 
LVL 24

Expert Comment

by:StephenJR
ID: 36585877
Andreas - I had a play and this did something - is it what you want? You could always try experimenting with the numbers:
With ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 20, 120, 100, 20)
    .TextFrame.Characters.Text = "Hello"
    .Left = 20
    .Top = ActiveChart.ChartArea.Height * 0.9
End With

Open in new window

0
 
LVL 24

Accepted Solution

by:
StephenJR earned 500 total points
ID: 36585941
I must say I'm not quite sure why this appears to work as it does, can't see why the position of the text box and the chart should be linked.
0
 

Author Comment

by:AndreasHermle
ID: 36586105
Hi Stephen,

.... can't see why the position of the text box and the chart should be linked.
That's what I thought as well when I first saw this snippet in some excel forum. But the original code works great, so DOES your TWEAK!

Thank you very much for your professional help. Regards, Andreas

0
 

Author Closing Comment

by:AndreasHermle
ID: 36586108
As always, great job and swift support from your side.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now