Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-29-2012, 01:17 PM
excelledsoftware excelledsoftware is offline Macro To Delete Instance across multiple slides. Windows 7 64bit Macro To Delete Instance across multiple slides. Office 2003
IT Specialist
Macro To Delete Instance across multiple slides.
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default Macro To Delete Instance across multiple slides.


Hello,

As I progress through my project I find that I may need to delete a particular autoshape on a certain number of slides. Basically I have a call out autoshape with a message in it in about 30 slides 21-51 I want a macro to select the shape (has the same name each time) and delete it. I can record this for 1 slide but Im not sure how to make the macro repeat it for every slide and then stop when it cannot find that shape on a slide or even better if I could use an input box to say which slides I want it to perform the macro on.

Thanks
Reply With Quote
  #2  
Old 03-01-2012, 12:42 AM
JohnWilson JohnWilson is offline Macro To Delete Instance across multiple slides. Windows 7 64bit Macro To Delete Instance across multiple slides. Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

The first macro will delete any instance of the name found the second only on selected slides.

Code:
Sub delete_all()
Dim shpname As String
Dim osld As Slide
Dim i As Integer
shpname = "the name"
On Error Resume Next
For Each osld In ActivePresentation.Slides
osld.Shapes(shpname).Delete
Next osld
End Sub

Sub deleteFrom_Sel()
Dim shpname As String
Dim osld As Slide
Dim i As Integer
shpname = "the name"
On Error Resume Next
For Each osld In ActiveWindow.Selection.SlideRange
osld.Shapes(shpname).Delete
Next osld
End Sub
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 03-01-2012, 07:29 PM
excelledsoftware excelledsoftware is offline Macro To Delete Instance across multiple slides. Windows 7 64bit Macro To Delete Instance across multiple slides. Office 2003
IT Specialist
Macro To Delete Instance across multiple slides.
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Very cool John,

Here it is

Sub deleteFrom_Sel()
Dim shpname As String
Dim osld As Slide
Dim i As Integer
shpname = InputBox("Paste Shape Name Here")
On Error Resume Next
For Each osld In ActiveWindow.Selection.SlideRange
osld.Shapes(shpname).Delete
Next osld
End Sub


So since this worked so nicely how could I go about repeating a recorded macro for every slide. The macro to be recorded would be macro1 or macro4 etc. and this would be asked for by an input box. The problem is though when using application.run it has the file name and then macro name so Im not sure how hard it would be to be able to run this code then it prompt an input box for what macro number you want to run and then this macro would run on all selected slides. This would be way awesome if you needed to add a shape on each slide and send it backward 20 times for 20 slides.

Thanks
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Animation across multiple slides - please help jpscience PowerPoint 3 12-13-2011 11:32 AM
Multiple Monitors/One Presentation/Different Slides future PowerPoint 0 12-12-2011 02:20 PM
Macro To Delete Instance across multiple slides. Music in Powerpoint (multiple slides) Karelia Suite PowerPoint 1 11-05-2011 08:34 AM
Macro To Delete Instance across multiple slides. How to create multiple pages, 1 instance of word window cs_starter Mail Merge 1 09-08-2011 12:52 AM
Macro To Delete Instance across multiple slides. Resize video across multiple slides joelas PowerPoint 3 09-28-2010 07:59 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:16 AM.


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