WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

VBA and Chart Legends (2003 and 2007)

 
   Home -> Office -> Charting RSS
Next:  Unable to get the Interior property of the PlotAr..  
Author Message
Barb Reinhardt

External


Since: Aug 01, 2006
Posts: 1349



(Msg. 1) Posted: Tue Sep 02, 2008 6:54 am
Post subject: VBA and Chart Legends (2003 and 2007)
Archived from groups: microsoft>public>excel>charting (more info?)

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
Back to top
Login to vote
Andy Pope

External


Since: Mar 23, 2007
Posts: 711



(Msg. 2) Posted: Tue Sep 02, 2008 3:16 pm
Post subject: Re: VBA and Chart Legends (2003 and 2007) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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" <BarbReinhardt DeleteThis @discussions.microsoft.com> wrote in message
news:CB71D19E-C366-47BB-9D86-9E252E71634C@microsoft.com...
>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
>
Back to top
Login to vote
Barb Reinhardt

External


Since: Aug 01, 2006
Posts: 1349



(Msg. 3) Posted: Tue Sep 02, 2008 3:16 pm
Post subject: Re: VBA and Chart Legends (2003 and 2007) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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" <BarbReinhardt.TakeThisOut@discussions.microsoft.com> wrote in message
> news:CB71D19E-C366-47BB-9D86-9E252E71634C@microsoft.com...
> >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
> >
>
>
Back to top
Login to vote
Andy Pope

External


Since: Mar 23, 2007
Posts: 711



(Msg. 4) Posted: Tue Sep 02, 2008 4:37 pm
Post subject: Re: VBA and Chart Legends (2003 and 2007) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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" <BarbReinhardt RemoveThis @discussions.microsoft.com> wrote in message
news:E0DB3150-6180-435D-A1A8-30DDD8E9C3BB@microsoft.com...
> 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" <BarbReinhardt RemoveThis @discussions.microsoft.com> wrote in
>> message
>> news:CB71D19E-C366-47BB-9D86-9E252E71634C@microsoft.com...
>> >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
>> >
>>
>>
Back to top
Login to vote
Barb Reinhardt

External


Since: Aug 01, 2006
Posts: 1349



(Msg. 5) Posted: Tue Sep 02, 2008 4:37 pm
Post subject: Re: VBA and Chart Legends (2003 and 2007) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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" <BarbReinhardt RemoveThis @discussions.microsoft.com> wrote in message
> news:E0DB3150-6180-435D-A1A8-30DDD8E9C3BB@microsoft.com...
> > 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" <BarbReinhardt RemoveThis @discussions.microsoft.com> wrote in
> >> message
> >> news:CB71D19E-C366-47BB-9D86-9E252E71634C@microsoft.com...
> >> >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
> >> >
> >>
> >>
>
>
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Charting All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET