[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2011-09-23
4
Medium Priority
?
218 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

834 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