Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 Text Box
Hello,
I am trying to add a text box to the bottom left portion of a chart using Excel 2007 (the trial version downloaded from Microsoft). I could do this with Excel 2003 using the following code: Chheight = ActiveChart.ChartArea.Height Chtleft = ActiveChart.ChartArea.Left ActiveChart.TextBoxes.Add(Chtleft, Chheight, 10, 10).Select Selection.Characters.Text = "This is my text" Selection.autosize = true With Excel 2007, it will not place the text box below the x axis, no matter what value I put in for Chheight. And, I get an error message when trying to autosize the text box. Any ideas? Thanks, Bill |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 Text Box
Bill
I believe that was broken in all beta releases, it is now fixed on RTM -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "Bill" wrote in message ink.net... Hello, I am trying to add a text box to the bottom left portion of a chart using Excel 2007 (the trial version downloaded from Microsoft). I could do this with Excel 2003 using the following code: Chheight = ActiveChart.ChartArea.Height Chtleft = ActiveChart.ChartArea.Left ActiveChart.TextBoxes.Add(Chtleft, Chheight, 10, 10).Select Selection.Characters.Text = "This is my text" Selection.autosize = true With Excel 2007, it will not place the text box below the x axis, no matter what value I put in for Chheight. And, I get an error message when trying to autosize the text box. Any ideas? Thanks, Bill |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 Text Box
Well, it doesn't look fixed to me. I ran this short procedure on an embedded
chart: Sub ChartTextBox() With ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, _ 0, ActiveChart.ChartArea.Height, 100, 12) .TextFrame.Characters.Text = "Testing text box position" End With End Sub and the resulting textbox, which in 2003 would have butted against the bottom of the chart, instead extended below the chart. It was line wrapped like this Testing text box position with the top 2/3 of the first line in the chart, and the rest showing below it. When I ran the same procedure on a chart sheet, the textbox was created above the lower axis. Inserting this line before End With did not move the textbox: .Top = ActiveChart.ChartArea.Height - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Nick Hodge" wrote in message ... Bill I believe that was broken in all beta releases, it is now fixed on RTM -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "Bill" wrote in message ink.net... Hello, I am trying to add a text box to the bottom left portion of a chart using Excel 2007 (the trial version downloaded from Microsoft). I could do this with Excel 2003 using the following code: Chheight = ActiveChart.ChartArea.Height Chtleft = ActiveChart.ChartArea.Left ActiveChart.TextBoxes.Add(Chtleft, Chheight, 10, 10).Select Selection.Characters.Text = "This is my text" Selection.autosize = true With Excel 2007, it will not place the text box below the x axis, no matter what value I put in for Chheight. And, I get an error message when trying to autosize the text box. Any ideas? Thanks, Bill |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 Text Box
The textbox within the embedded chart works as expected if the textbox does
not line wrap. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Jon Peltier" wrote in message ... Well, it doesn't look fixed to me. I ran this short procedure on an embedded chart: Sub ChartTextBox() With ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, _ 0, ActiveChart.ChartArea.Height, 100, 12) .TextFrame.Characters.Text = "Testing text box position" End With End Sub and the resulting textbox, which in 2003 would have butted against the bottom of the chart, instead extended below the chart. It was line wrapped like this Testing text box position with the top 2/3 of the first line in the chart, and the rest showing below it. When I ran the same procedure on a chart sheet, the textbox was created above the lower axis. Inserting this line before End With did not move the textbox: .Top = ActiveChart.ChartArea.Height - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Nick Hodge" wrote in message ... Bill I believe that was broken in all beta releases, it is now fixed on RTM -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "Bill" wrote in message ink.net... Hello, I am trying to add a text box to the bottom left portion of a chart using Excel 2007 (the trial version downloaded from Microsoft). I could do this with Excel 2003 using the following code: Chheight = ActiveChart.ChartArea.Height Chtleft = ActiveChart.ChartArea.Left ActiveChart.TextBoxes.Add(Chtleft, Chheight, 10, 10).Select Selection.Characters.Text = "This is my text" Selection.autosize = true With Excel 2007, it will not place the text box below the x axis, no matter what value I put in for Chheight. And, I get an error message when trying to autosize the text box. Any ideas? Thanks, Bill |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 Text Box
Hello,
It does work on the embedded chart, but not on a chart that has been moved to a new sheet. I can't seem to place the text box below the x axis in this case. Bill "Jon Peltier" wrote in message ... The textbox within the embedded chart works as expected if the textbox does not line wrap. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Jon Peltier" wrote in message ... Well, it doesn't look fixed to me. I ran this short procedure on an embedded chart: Sub ChartTextBox() With ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, _ 0, ActiveChart.ChartArea.Height, 100, 12) .TextFrame.Characters.Text = "Testing text box position" End With End Sub and the resulting textbox, which in 2003 would have butted against the bottom of the chart, instead extended below the chart. It was line wrapped like this Testing text box position with the top 2/3 of the first line in the chart, and the rest showing below it. When I ran the same procedure on a chart sheet, the textbox was created above the lower axis. Inserting this line before End With did not move the textbox: .Top = ActiveChart.ChartArea.Height - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Nick Hodge" wrote in message ... Bill I believe that was broken in all beta releases, it is now fixed on RTM -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "Bill" wrote in message ink.net... Hello, I am trying to add a text box to the bottom left portion of a chart using Excel 2007 (the trial version downloaded from Microsoft). I could do this with Excel 2003 using the following code: Chheight = ActiveChart.ChartArea.Height Chtleft = ActiveChart.ChartArea.Left ActiveChart.TextBoxes.Add(Chtleft, Chheight, 10, 10).Select Selection.Characters.Text = "This is my text" Selection.autosize = true With Excel 2007, it will not place the text box below the x axis, no matter what value I put in for Chheight. And, I get an error message when trying to autosize the text box. Any ideas? Thanks, Bill |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 Text Box
Right, I can do it manually (with difficulty because it isn't easy to select
the textbox, especially with the touchpad on that old laptop), but VBA can't seem to access the bottom region of the chart. I tried various combinations of .Top = ActiveChart.ChartArea.Height thinking that maybe order of commands had something to do with it. Nope. I still have one or two ideas, but I'm not holding out much hope. I think the textboxes are not yet fixed. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "Bill" wrote in message ink.net... Hello, It does work on the embedded chart, but not on a chart that has been moved to a new sheet. I can't seem to place the text box below the x axis in this case. Bill "Jon Peltier" wrote in message ... The textbox within the embedded chart works as expected if the textbox does not line wrap. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Jon Peltier" wrote in message ... Well, it doesn't look fixed to me. I ran this short procedure on an embedded chart: Sub ChartTextBox() With ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, _ 0, ActiveChart.ChartArea.Height, 100, 12) .TextFrame.Characters.Text = "Testing text box position" End With End Sub and the resulting textbox, which in 2003 would have butted against the bottom of the chart, instead extended below the chart. It was line wrapped like this Testing text box position with the top 2/3 of the first line in the chart, and the rest showing below it. When I ran the same procedure on a chart sheet, the textbox was created above the lower axis. Inserting this line before End With did not move the textbox: .Top = ActiveChart.ChartArea.Height - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Nick Hodge" wrote in message ... Bill I believe that was broken in all beta releases, it is now fixed on RTM -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "Bill" wrote in message ink.net... Hello, I am trying to add a text box to the bottom left portion of a chart using Excel 2007 (the trial version downloaded from Microsoft). I could do this with Excel 2003 using the following code: Chheight = ActiveChart.ChartArea.Height Chtleft = ActiveChart.ChartArea.Left ActiveChart.TextBoxes.Add(Chtleft, Chheight, 10, 10).Select Selection.Characters.Text = "This is my text" Selection.autosize = true With Excel 2007, it will not place the text box below the x axis, no matter what value I put in for Chheight. And, I get an error message when trying to autosize the text box. Any ideas? Thanks, Bill |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 Text Box
Okay, my lame idea worked. This will move the textbox to the bottom of the
chart: ActiveChart.Shapes(1).IncrementTop ActiveChart.ChartArea.Height - ActiveChart.Shapes(1).Top so the working procedure is: Sub ChartTextBox2() With ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, _ 0, 0, 200, 16) .TextFrame.Characters.Text = "Testing text box positioning" .IncrementTop ActiveChart.ChartArea.Height - .Top End With End Sub I also noticed the other day while playing around with textboxes that autosizing a new textbox in Excel 2007 does not change the width of the textbox to fit the text, only the height. So unless I've missed something obvious (which is not completely unlikely), a large number of simple routines will now not work as expected. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Jon Peltier" wrote in message ... Right, I can do it manually (with difficulty because it isn't easy to select the textbox, especially with the touchpad on that old laptop), but VBA can't seem to access the bottom region of the chart. I tried various combinations of .Top = ActiveChart.ChartArea.Height thinking that maybe order of commands had something to do with it. Nope. I still have one or two ideas, but I'm not holding out much hope. I think the textboxes are not yet fixed. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "Bill" wrote in message ink.net... Hello, It does work on the embedded chart, but not on a chart that has been moved to a new sheet. I can't seem to place the text box below the x axis in this case. Bill "Jon Peltier" wrote in message ... The textbox within the embedded chart works as expected if the textbox does not line wrap. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Jon Peltier" wrote in message ... Well, it doesn't look fixed to me. I ran this short procedure on an embedded chart: Sub ChartTextBox() With ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, _ 0, ActiveChart.ChartArea.Height, 100, 12) .TextFrame.Characters.Text = "Testing text box position" End With End Sub and the resulting textbox, which in 2003 would have butted against the bottom of the chart, instead extended below the chart. It was line wrapped like this Testing text box position with the top 2/3 of the first line in the chart, and the rest showing below it. When I ran the same procedure on a chart sheet, the textbox was created above the lower axis. Inserting this line before End With did not move the textbox: .Top = ActiveChart.ChartArea.Height - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Nick Hodge" wrote in message ... Bill I believe that was broken in all beta releases, it is now fixed on RTM -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "Bill" wrote in message ink.net... Hello, I am trying to add a text box to the bottom left portion of a chart using Excel 2007 (the trial version downloaded from Microsoft). I could do this with Excel 2003 using the following code: Chheight = ActiveChart.ChartArea.Height Chtleft = ActiveChart.ChartArea.Left ActiveChart.TextBoxes.Add(Chtleft, Chheight, 10, 10).Select Selection.Characters.Text = "This is my text" Selection.autosize = true With Excel 2007, it will not place the text box below the x axis, no matter what value I put in for Chheight. And, I get an error message when trying to autosize the text box. Any ideas? Thanks, Bill |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 Text Box
If I create the text box at 0,0
With ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, _ 0, 0, 200, 16) There is still a margin between the chart's edges and the textbox's. I can drag the textbox up into the corner, and now its .left and .top properties both read -4. This isn't just the textbox, either. I can drag the plot area into the top left corner, and its .left and .top also both read -4. We can work with all of this, but it's sure inconsistent. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Jon Peltier" wrote in message ... Okay, my lame idea worked. This will move the textbox to the bottom of the chart: ActiveChart.Shapes(1).IncrementTop ActiveChart.ChartArea.Height - ActiveChart.Shapes(1).Top so the working procedure is: Sub ChartTextBox2() With ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, _ 0, 0, 200, 16) .TextFrame.Characters.Text = "Testing text box positioning" .IncrementTop ActiveChart.ChartArea.Height - .Top End With End Sub I also noticed the other day while playing around with textboxes that autosizing a new textbox in Excel 2007 does not change the width of the textbox to fit the text, only the height. So unless I've missed something obvious (which is not completely unlikely), a large number of simple routines will now not work as expected. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Jon Peltier" wrote in message ... Right, I can do it manually (with difficulty because it isn't easy to select the textbox, especially with the touchpad on that old laptop), but VBA can't seem to access the bottom region of the chart. I tried various combinations of .Top = ActiveChart.ChartArea.Height thinking that maybe order of commands had something to do with it. Nope. I still have one or two ideas, but I'm not holding out much hope. I think the textboxes are not yet fixed. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "Bill" wrote in message ink.net... Hello, It does work on the embedded chart, but not on a chart that has been moved to a new sheet. I can't seem to place the text box below the x axis in this case. Bill "Jon Peltier" wrote in message ... The textbox within the embedded chart works as expected if the textbox does not line wrap. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Jon Peltier" wrote in message ... Well, it doesn't look fixed to me. I ran this short procedure on an embedded chart: Sub ChartTextBox() With ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, _ 0, ActiveChart.ChartArea.Height, 100, 12) .TextFrame.Characters.Text = "Testing text box position" End With End Sub and the resulting textbox, which in 2003 would have butted against the bottom of the chart, instead extended below the chart. It was line wrapped like this Testing text box position with the top 2/3 of the first line in the chart, and the rest showing below it. When I ran the same procedure on a chart sheet, the textbox was created above the lower axis. Inserting this line before End With did not move the textbox: .Top = ActiveChart.ChartArea.Height - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Nick Hodge" wrote in message ... Bill I believe that was broken in all beta releases, it is now fixed on RTM -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "Bill" wrote in message ink.net... Hello, I am trying to add a text box to the bottom left portion of a chart using Excel 2007 (the trial version downloaded from Microsoft). I could do this with Excel 2003 using the following code: Chheight = ActiveChart.ChartArea.Height Chtleft = ActiveChart.ChartArea.Left ActiveChart.TextBoxes.Add(Chtleft, Chheight, 10, 10).Select Selection.Characters.Text = "This is my text" Selection.autosize = true With Excel 2007, it will not place the text box below the x axis, no matter what value I put in for Chheight. And, I get an error message when trying to autosize the text box. Any ideas? Thanks, Bill |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 Text Box
Other shapes behave the same as the text box, in that they have problems
going low on a chart sheet, but they go where you put them on an embedded chart, with text spilling out of the chart over the worksheet. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Jon Peltier" wrote in message ... Well, it doesn't look fixed to me. I ran this short procedure on an embedded chart: Sub ChartTextBox() With ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, _ 0, ActiveChart.ChartArea.Height, 100, 12) .TextFrame.Characters.Text = "Testing text box position" End With End Sub and the resulting textbox, which in 2003 would have butted against the bottom of the chart, instead extended below the chart. It was line wrapped like this Testing text box position with the top 2/3 of the first line in the chart, and the rest showing below it. When I ran the same procedure on a chart sheet, the textbox was created above the lower axis. Inserting this line before End With did not move the textbox: .Top = ActiveChart.ChartArea.Height - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Nick Hodge" wrote in message ... Bill I believe that was broken in all beta releases, it is now fixed on RTM -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "Bill" wrote in message ink.net... Hello, I am trying to add a text box to the bottom left portion of a chart using Excel 2007 (the trial version downloaded from Microsoft). I could do this with Excel 2003 using the following code: Chheight = ActiveChart.ChartArea.Height Chtleft = ActiveChart.ChartArea.Left ActiveChart.TextBoxes.Add(Chtleft, Chheight, 10, 10).Select Selection.Characters.Text = "This is my text" Selection.autosize = true With Excel 2007, it will not place the text box below the x axis, no matter what value I put in for Chheight. And, I get an error message when trying to autosize the text box. Any ideas? Thanks, Bill |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 Text Box
and the resulting textbox, which in 2003 would have butted against the
Hmm, I spoke without checking. In 2003, the textbox will position itself so its top edge is at the bottom of the chartarea, and the rest of it is not seen, but it's in a hidden drawing layer in the chart just out of view. After it is dragged back into the chart area, it can no longer be moved outside of the chart area. I'd never noticed that a shape could be drawn so its initial position is outside the bounds of the chart area. Learn something new every day. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Jon Peltier" wrote in message ... Well, it doesn't look fixed to me. I ran this short procedure on an embedded chart: Sub ChartTextBox() With ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, _ 0, ActiveChart.ChartArea.Height, 100, 12) .TextFrame.Characters.Text = "Testing text box position" End With End Sub and the resulting textbox, which in 2003 would have butted against the bottom of the chart, instead extended below the chart. It was line wrapped like this Testing text box position with the top 2/3 of the first line in the chart, and the rest showing below it. When I ran the same procedure on a chart sheet, the textbox was created above the lower axis. Inserting this line before End With did not move the textbox: .Top = ActiveChart.ChartArea.Height - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "Nick Hodge" wrote in message ... Bill I believe that was broken in all beta releases, it is now fixed on RTM -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "Bill" wrote in message ink.net... Hello, I am trying to add a text box to the bottom left portion of a chart using Excel 2007 (the trial version downloaded from Microsoft). I could do this with Excel 2003 using the following code: Chheight = ActiveChart.ChartArea.Height Chtleft = ActiveChart.ChartArea.Left ActiveChart.TextBoxes.Add(Chtleft, Chheight, 10, 10).Select Selection.Characters.Text = "This is my text" Selection.autosize = true With Excel 2007, it will not place the text box below the x axis, no matter what value I put in for Chheight. And, I get an error message when trying to autosize the text box. Any ideas? Thanks, Bill |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 Text Box
This is indeed a problem, I have it as well. From the Excel 2007 VBA
documentation, this behavious is as expected because the object created is considered to be a multiline text object and the height is changed by Autosize and not the width (as per all previous versions of Excel). What I cant find is how to chnage this to a non-multiline text object. The documentation referes to a property Multiline = boolean but this errors as an undefined property. Any one can help it would be greaty appreaciated bu both of us. Cheers, Dennis. On Dec 6 2006, 3:51 am, "Bill" wrote: Hello, I am trying to add a text box to the bottom left portion of a chart usingExcel2007 (the trial version downloaded from Microsoft). I could do this withExcel2003 using the following code: Chheight = ActiveChart.ChartArea.Height Chtleft = ActiveChart.ChartArea.Left ActiveChart.TextBoxes.Add(Chtleft, Chheight, 10, 10).Select Selection.Characters.Text = "This is my text" Selection.autosize = true WithExcel2007, it will not place the text box below the x axis, no matter what value I put in for Chheight. And, I get an error message when trying toautosizethe text box. Any ideas? Thanks, Bill |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Default font for pasted text in text boxes - Excel 2007 | Excel Discussion (Misc queries) | |||
Excel 2007 text import as text not date | Excel Discussion (Misc queries) | |||
autofit text when resizing text box in Excel 2007 | Excel Discussion (Misc queries) | |||
text box in Excel 2007 | Excel Worksheet Functions | |||
Excel 2007 Text Box | Excel Discussion (Misc queries) |