Solved

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

Posted on 2011-09-23
4
189 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
.Range Set 25 76
Excel Formula 5 43
Excel Need to return the text of a filter column 11 20
Excel Cell Total 3 20
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

776 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