Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 3,355
Default VBA and Chart Legends (2003 and 2007)

I have this snippet of code to update the legends to the bottom of the chart

For Each objCht In WS.ChartObjects
With objCht.Chart
.Legend.Position = xlLegendPositionBottom
End With
Next objCht

If I record this in 2003 OR 2007, I get this

ActiveChart.Legend.Select
Selection.Position = xlBottom

But if I type .Legend.Position in the original snippet,
xlLegendPositionBottom is an option and xlBottom is not an option. In
Office 2007, it appears to Gack on xlLegendPositionBottom and prefers
xlBottom. Is this a bug, or am I missing something?

Thanks,

Barb Reinhardt

  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default VBA and Chart Legends (2003 and 2007)

Hi,

Not a bug but a difference between referencing the Legend object position
property and the Selection object.

xlLegendPositionBottom and xlbottom both return the same value, -4107


Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Barb Reinhardt" wrote in message
...
I have this snippet of code to update the legends to the bottom of the
chart

For Each objCht In WS.ChartObjects
With objCht.Chart
.Legend.Position = xlLegendPositionBottom
End With
Next objCht

If I record this in 2003 OR 2007, I get this

ActiveChart.Legend.Select
Selection.Position = xlBottom

But if I type .Legend.Position in the original snippet,
xlLegendPositionBottom is an option and xlBottom is not an option. In
Office 2007, it appears to Gack on xlLegendPositionBottom and prefers
xlBottom. Is this a bug, or am I missing something?

Thanks,

Barb Reinhardt


  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 3,355
Default VBA and Chart Legends (2003 and 2007)

I'm getting reports that it gives a run time error when
xlLegendPositionBottom is being used.
--
HTH,
Barb Reinhardt



"Andy Pope" wrote:

Hi,

Not a bug but a difference between referencing the Legend object position
property and the Selection object.

xlLegendPositionBottom and xlbottom both return the same value, -4107


Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Barb Reinhardt" wrote in message
...
I have this snippet of code to update the legends to the bottom of the
chart

For Each objCht In WS.ChartObjects
With objCht.Chart
.Legend.Position = xlLegendPositionBottom
End With
Next objCht

If I record this in 2003 OR 2007, I get this

ActiveChart.Legend.Select
Selection.Position = xlBottom

But if I type .Legend.Position in the original snippet,
xlLegendPositionBottom is an option and xlBottom is not an option. In
Office 2007, it appears to Gack on xlLegendPositionBottom and prefers
xlBottom. Is this a bug, or am I missing something?

Thanks,

Barb Reinhardt



  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default VBA and Chart Legends (2003 and 2007)

In my quick test using either constant in both code examples worked.

Do you have more details when failing, such as chart and data type.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Barb Reinhardt" wrote in message
...
I'm getting reports that it gives a run time error when
xlLegendPositionBottom is being used.
--
HTH,
Barb Reinhardt



"Andy Pope" wrote:

Hi,

Not a bug but a difference between referencing the Legend object position
property and the Selection object.

xlLegendPositionBottom and xlbottom both return the same value, -4107


Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Barb Reinhardt" wrote in
message
...
I have this snippet of code to update the legends to the bottom of the
chart

For Each objCht In WS.ChartObjects
With objCht.Chart
.Legend.Position = xlLegendPositionBottom
End With
Next objCht

If I record this in 2003 OR 2007, I get this

ActiveChart.Legend.Select
Selection.Position = xlBottom

But if I type .Legend.Position in the original snippet,
xlLegendPositionBottom is an option and xlBottom is not an option.
In
Office 2007, it appears to Gack on xlLegendPositionBottom and prefers
xlBottom. Is this a bug, or am I missing something?

Thanks,

Barb Reinhardt




  #5   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 3,355
Default VBA and Chart Legends (2003 and 2007)

If I get any more details, I'll let you know.
--
HTH,
Barb Reinhardt



"Andy Pope" wrote:

In my quick test using either constant in both code examples worked.

Do you have more details when failing, such as chart and data type.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Barb Reinhardt" wrote in message
...
I'm getting reports that it gives a run time error when
xlLegendPositionBottom is being used.
--
HTH,
Barb Reinhardt



"Andy Pope" wrote:

Hi,

Not a bug but a difference between referencing the Legend object position
property and the Selection object.

xlLegendPositionBottom and xlbottom both return the same value, -4107


Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Barb Reinhardt" wrote in
message
...
I have this snippet of code to update the legends to the bottom of the
chart

For Each objCht In WS.ChartObjects
With objCht.Chart
.Legend.Position = xlLegendPositionBottom
End With
Next objCht

If I record this in 2003 OR 2007, I get this

ActiveChart.Legend.Select
Selection.Position = xlBottom

But if I type .Legend.Position in the original snippet,
xlLegendPositionBottom is an option and xlBottom is not an option.
In
Office 2007, it appears to Gack on xlLegendPositionBottom and prefers
xlBottom. Is this a bug, or am I missing something?

Thanks,

Barb Reinhardt





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart Legends Tina Charts and Charting in Excel 1 March 20th 07 07:22 PM
formatting chart legends Dean1234567890 Charts and Charting in Excel 1 September 4th 06 07:15 PM
Chart legends question [email protected] Excel Discussion (Misc queries) 1 July 3rd 06 01:19 AM
Help, I can't resize chart legends on my axes or titles XYZZYX59 Charts and Charting in Excel 2 March 14th 06 02:01 AM
bar chart with multiple legends? Lizzi Charts and Charting in Excel 2 January 19th 05 08:01 PM


All times are GMT +1. The time now is 01:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"