View Single Post
 
Old 06-06-2015, 01:12 PM
PowerPoint_VBA PowerPoint_VBA is offline Windows 8 Office 2010 32bit
Novice
 
Join Date: Jun 2015
Posts: 3
PowerPoint_VBA is on a distinguished road
Default

Thank you very much!

It is almost working. However I found a way in which power point charts are really misleading (attached file).

As you can see your macro works great on second slide, but on first it is mislead.
It's about legend order. On first slide it's "upside down" in excel meaning, on second one it's ok.

On first slide it is counting the opposite way (it should left "e" which is 5th from the beggining, instead it does not delete "l" which is 5th but from the end).

So to make it automatic, macro need to check the order. If the order is "upside down" it should take "upside down" legend entry and delete it .



Changing:
Code:
If Not b_val Then ocht.Legend.LegendEntries(m).Delete
Into:

Code:
If <Legend Enteries has appropriate order> Then

If Not b_val Then ocht.Legend.LegendEntries(m).Delete

Else

If Not b_val Then ocht.Legend.LegendEntries(ocht.SeriesCollection.Count - m + 1).Delete

End if
Do you have and idea, how to check Legend Order?


Of course it is possible to change Legend into "under chart" in each before starting macro, but then on some macro should reverse it and on some not so it would be difficult this way .
Attached Files
File Type: pptx Macro_legends_test.pptx (80.3 KB, 15 views)
Reply With Quote