Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-06-2015, 12:07 AM
PowerPoint_VBA PowerPoint_VBA is offline Power Point - Deleting Legend enteries via VBA Windows 8 Power Point - Deleting Legend enteries via VBA Office 2010 32bit
Novice
Power Point - Deleting Legend enteries via VBA
 
Join Date: Jun 2015
Posts: 3
PowerPoint_VBA is on a distinguished road
Default Power Point - Deleting Legend enteries via VBA

Hello,



I am preparing automization for data in excel and presentation. The last thing I struggle with is deleting unnecessary legend entries in power point.

I suppose I would be able to get rid of them in excel via VBA, but still it doesn't change anything because even if I do so it will not affect power point presentation. Power Point Charts are linked to excel, and as I checked: deleting legend enteries in Excel file will not affect linked charts in PowerPoint (checked on Office 2010).

What I would like to do is some macro which will check each slide, each chart. And if there is a blank data entry delete it's legend entry.

Here is how I would like to change my graphs:
Before
After


I think something like that will make it, however I do not know VBA for PowerPoint.

Code:
Sub MacroDeletingLegendEnteries()

Dim ppt As Presentation
Dim s As Slide
Dim ch As Chart

'Count from slide one to last slide
For i=1 to ppt.Slides.Count

	'Count from chart one to last chart on this slide
	For x=1 to <last chart on this slide>

		'Take any action only if chart has legend - there are some charts which don't need it
		If <chart has a legend> Then

			'Count from series 1 to last one
			For z=1 to <Number of data series on slide>
				
				'If the legend entry does not exist, then delete it legend entry on chart
				If <Data series z = 0 (there isn't any data on graph)> Then
					<Delete Legend entry number z>
				End If
			Next z

		End if
	
	Next x


Next i



End Sub

Thank you very much for any help with <> entries .
Reply With Quote
 

Tags
powerpoint macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
can power point LINK to embedded object in power point ? johnseito PowerPoint 0 05-24-2014 04:31 AM
Power Point - Deleting Legend enteries via VBA Power Point and Flash Paincho PowerPoint 1 06-27-2011 08:07 AM
Microsoft Power Point 2004 to Office Power Point 2007 chuff PowerPoint 0 03-20-2011 01:23 PM
Power Point on the Web Carthalion PowerPoint 0 03-03-2010 09:59 AM
power point ladonna12 PowerPoint 2 02-16-2009 09:34 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft